Post by hellsblizzz on Jul 31, 2015 4:20:10 GMT -8
Hello ,
I use to have this great feature for my members back on v4. They could change the main banner in there Profile to multible banners i placed in . I lost the code at first but recently i found it back on my old pc. I tried it on v5 but it dosnt seem to work,unless its broken or maybe i made a mistake .
Anyway i would like to ask if its possible to make a plugin about it on v5. I searched the whole libary but cant really find something simular . If its already there and i missed it could somebody please show me the direction.
Small note : im not talking about banners on diferant boards. But a selection in your profile like you would for example be able to change a forum theme.
Here is the OLD V4 code and i believe it was written back than by Peter (not sure)
Global header:
Main footer:
Anyway i hope im not wasting peoples time . But this was a great add to my forum back than . I would love to see it back in a easy to use plugin.
Thank you for reading.
I use to have this great feature for my members back on v4. They could change the main banner in there Profile to multible banners i placed in . I lost the code at first but recently i found it back on my old pc. I tried it on v5 but it dosnt seem to work,unless its broken or maybe i made a mistake .
Anyway i would like to ask if its possible to make a plugin about it on v5. I searched the whole libary but cant really find something simular . If its already there and i missed it could somebody please show me the direction.
Small note : im not talking about banners on diferant boards. But a selection in your profile like you would for example be able to change a forum theme.
Here is the OLD V4 code and i believe it was written back than by Peter (not sure)
Global header:
inWhat this script does is let's your members select a different banner to show in the welcome table. It is selectable from the profile, and it will remember the selection next time he/she visits.
Please read the instructions carefully.
<script type="text/javascript">
<!--
// Created by PopThosePringles
// URL to the blank image (added in skin area).
var theBlank = "http://www.4d5.net/v4images/blank.gif";
// List all the banners to show in drop down
var iBanners = [
["Select Banner", "DEFAULT BANNER URL"],
["Banner 1", "URL 1"],
["Banner 2", "URL 2"],
["Banner 3", "URL 3"],
["Banner 4", "URL 4"]
];
if(document.getElementsByTagName("img").item(0).src == theBlank){
document.getElementsByTagName("img").item(0).id = "banselect";
}
function getCook(){
if(document.cookie.match(/banid=(\d+)/)){
return RegExp.$1;
} else {
if(document.getElementById("banselect")){
document.getElementById("banselect").src = iBanners[0][1];
}
return null;
}
}
if(document.getElementById("banselect")){
if(getCook() != null){
document.getElementById("banselect").src = iBanners[getCook()][1];
}
}
//-->
</script>
Ok, first thing, and most important part of the code is the logo image. Enter a blank 1 x 1 pixel image as the logo. You can do this by going to admin > skins > modify skin, enter the blank image url into the logo field. Once you have done that, add that blank image url into the script. Change theBlank variable so it has your blank image url. Make sure you get the right, otherwise the script will not work.
Next part would be to add your default banner, this will be the one that will show up when the user hasn't selected one. Enter this into the first one of the array...
["Select Banner", "DEFAULT BANNER URL"],
Next add the other banners in, just replace URL X with the URL. If you wish to add more then what's there, add another ["Banner 4", "URL 4"]. So for example, if I wanted to add 2 more banners I would have this...
var iBanners = [
["Select Banner", "DEFAULT BANNER URL"],
["Banner 1", "URL 1"],
["Banner 2", "URL 2"],
["Banner 3", "URL 3"],
["Banner 4", "URL 4"],
["Banner 4", "URL 5"],
["Banner 4", "URL 6"]
];
Simple :)
All you need to do now is add that code into your Global headers.
Now, this code below is the one that allows the members to select the banner from their profile. You shouldn't need to touch this, so all you need to do is add it to your Main footer.
<script type="text/javascript">
<!--
/*
Banner selection from profile - Created by Peter
This code cannot be reposted anywhere other than SSDesigns or ProBoards Support.
This header must stay intact.
*/
var iBBDesTxt = "Select a banner you wish to have show in the welcome table instead of the default one.";
function setCookie(name,value,expires,domain){
document.cookie = name + "=" + encodeURI(value) + ((expires == null) ? "" : "; expires=" + expires.toGMTString()) + ((domain == null) ? "" : "; domain=" + domain);
}
function doBanSelect(){
var iTable = document.getElementsByTagName("table");
var bSel = document.createElement("select");
var iBFont = document.createElement("font");
var bDesc = document.createTextNode("Banner:");
iBFont.size = "-2";
var iBBDes = iBFont.cloneNode(true).appendChild(document.createTextNode(iBBDesTxt));
iBFont.size = "-1";
iBFont.appendChild(bDesc);
bSel.onchange = function(){
var iDomain = location.hostname;
var ExpDate = new Date ();
ExpDate.setTime(ExpDate.getTime() + (180 * 24 * 3600 * 1000));
setCookie("banid", this.selectedIndex, ExpDate, iDomain);
}
for(b = 0; b < iBanners.length; b ++){
bSel.options[bSel.options.length] = new Option(iBanners[0], b);
if(b == parseInt(getCook())){
bSel.options.selected = true;
}
}
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).width == "650" && iTable.item(t).innerHTML.match(/Show Age:/)){
var nRow = iTable.item(t).insertRow(iTable.item(t).rows.length);
var nCell = nRow.insertCell(0);
nCell.appendChild(iBFont);
nCell = nRow.insertCell(1);
nCell.appendChild(bSel);
nCell = nRow.insertCell(2).appendChild(iBBDes);
}
}
}
if(location.href.match(/=modifyprofile&user=/) && document.modifyForm){
doBanSelect();
}
//-->
</script>sert code here
Main footer:
insert co<script type="text/javascript">
<!--
/*
Banner selection from profile - Created by Peter
This code cannot be reposted anywhere other than SSDesigns or ProBoards Support.
This header must stay intact.
*/
var iBBDesTxt = "Select a banner you wish to have show in the welcome table instead of the default one.";
function setCookie(name,value,expires,domain){
document.cookie = name + "=" + encodeURI(value) + ((expires == null) ? "" : "; expires=" + expires.toGMTString()) + ((domain == null) ? "" : "; domain=" + domain);
}
function doBanSelect(){
var iTable = document.getElementsByTagName("table");
var bSel = document.createElement("select");
var iBFont = document.createElement("font");
var bDesc = document.createTextNode("Banner:");
iBFont.size = "-2";
var iBBDes = iBFont.cloneNode(true).appendChild(document.createTextNode(iBBDesTxt));
iBFont.size = "-1";
iBFont.appendChild(bDesc);
bSel.onchange = function(){
var iDomain = location.hostname;
var ExpDate = new Date ();
ExpDate.setTime(ExpDate.getTime() + (180 * 24 * 3600 * 1000));
setCookie("banid", this.selectedIndex, ExpDate, iDomain);
}
for(b = 0; b < iBanners.length; b ++){
bSel.options[bSel.options.length] = new Option(iBanners[b][0], b);
if(b == parseInt(getCook())){
bSel.options[b].selected = true;
}
}
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).width == "650" && iTable.item(t).innerHTML.match(/Show Age:/)){
var nRow = iTable.item(t).insertRow(iTable.item(t).rows.length);
var nCell = nRow.insertCell(0);
nCell.appendChild(iBFont);
nCell = nRow.insertCell(1);
nCell.appendChild(bSel);
nCell = nRow.insertCell(2).appendChild(iBBDes);
}
}
}
if(location.href.match(/=modifyprofile&user=/) && document.modifyForm){
doBanSelect();
}
//-->
</script>
de here
Anyway i hope im not wasting peoples time . But this was a great add to my forum back than . I would love to see it back in a easy to use plugin.
Thank you for reading.