Post by SubDevo on Sept 8, 2009 3:54:50 GMT -8
Profile Background Image Using Censored Words by SubDevo
Tested in IE, FF, Opera and Safari
This code allows members to choose an image to use for their profile from a list of images the ADMIN controls. The admin puts the list into the "Censored words" list.
Enjoy!!!
SubDevo
This is an interesting approach! Try to follow along!
Example:
Let's say you have three images made especially for your forum, and you want to allow users to choose one of these images to use in their profile.
Open up your "Censored Words" list. We will be following this pattern:
Censor word Replacement
[pbg1] [pbg:URL TO IMAGE1]
[pbg2] [pbg:URL TO IMAGE2]
[pbg3] [pbg:URL TO IMAGE3]
The "Censor word" is not important. You may choose whatever you wish. Just make sure it is unique and not a common word! In this example we are using "[pbg1]".
The "Replacement" IS IMPORTANT!
It MUST start with "[pbg:", then the URL and end with a "]".
Once you have these set up, a member simply adds the "Censor word" for their selected image to their personal text. That's it! This word will NOT show in their miniprofile.
Example: User wants image 2 for their background image. He/she would modify their profile and add the Censor word to image number 2, to their personal text. In this example, it would be "[pbg2]".
To let members know about the new code, create a thread with the list of forum images and what Censor word to use for them.
Location: Global Footer
<script type="text/Javascript">
<!--
/* Profile Background Image Using Censored Words by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
// NO CODE EDIT. Edit your "Censored Words" list.
// Use a unique "Censor" word with [pbg:URL TO IMAGE] as the replacement.
// Put the "Censor" word in your personal text.
var td=document.getElementsByTagName("td"); var rL=location.href; var nR=/\[pbg:(.+?)\]/i; var n="";
if(rL.match(/=(display|(pm)?view|user|recent)/i)||document.title.match(/search/i)||document.postForm){
for(x=0;x<td.length;x++) {with(td[x]){
if(width=="20%"&&innerHTML.match(nR)){ n=nextSibling;
var bgI=RegExp.$1; innerHTML=innerHTML.replace(nR,"");
}}
}
} if(n&&bgI&&rL.match(/=viewprof/i)){n.style.backgroundImage="url("+bgI+")";}
// -->
</script>
Some things to be aware of:
If you remove this code, the background will go back to normal. But, the "[pbg3]" in everyone's personal text will remain and it will be replaced with whatever you have as the "Replacement". If you also delete the Censor words from the "Censored words" list, it will still show the "[pbg3]" in any members personal text that was using it. So, if you choose to use this code, and you remove it, you should send a mass PM/Email to all members and instruct them to remove the "Censor" word from their personal text.
Tested in IE, FF, Opera and Safari
This code allows members to choose an image to use for their profile from a list of images the ADMIN controls. The admin puts the list into the "Censored words" list.
Enjoy!!!
SubDevo
This is an interesting approach! Try to follow along!
Example:
Let's say you have three images made especially for your forum, and you want to allow users to choose one of these images to use in their profile.
Open up your "Censored Words" list. We will be following this pattern:
Censor word Replacement
[pbg1] [pbg:URL TO IMAGE1]
[pbg2] [pbg:URL TO IMAGE2]
[pbg3] [pbg:URL TO IMAGE3]
The "Censor word" is not important. You may choose whatever you wish. Just make sure it is unique and not a common word! In this example we are using "[pbg1]".
The "Replacement" IS IMPORTANT!
It MUST start with "[pbg:", then the URL and end with a "]".
Once you have these set up, a member simply adds the "Censor word" for their selected image to their personal text. That's it! This word will NOT show in their miniprofile.
Example: User wants image 2 for their background image. He/she would modify their profile and add the Censor word to image number 2, to their personal text. In this example, it would be "[pbg2]".
To let members know about the new code, create a thread with the list of forum images and what Censor word to use for them.
Location: Global Footer
<script type="text/Javascript">
<!--
/* Profile Background Image Using Censored Words by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
// NO CODE EDIT. Edit your "Censored Words" list.
// Use a unique "Censor" word with [pbg:URL TO IMAGE] as the replacement.
// Put the "Censor" word in your personal text.
var td=document.getElementsByTagName("td"); var rL=location.href; var nR=/\[pbg:(.+?)\]/i; var n="";
if(rL.match(/=(display|(pm)?view|user|recent)/i)||document.title.match(/search/i)||document.postForm){
for(x=0;x<td.length;x++) {with(td[x]){
if(width=="20%"&&innerHTML.match(nR)){ n=nextSibling;
var bgI=RegExp.$1; innerHTML=innerHTML.replace(nR,"");
}}
}
} if(n&&bgI&&rL.match(/=viewprof/i)){n.style.backgroundImage="url("+bgI+")";}
// -->
</script>
Some things to be aware of:
If you remove this code, the background will go back to normal. But, the "[pbg3]" in everyone's personal text will remain and it will be replaced with whatever you have as the "Replacement". If you also delete the Censor words from the "Censored words" list, it will still show the "[pbg3]" in any members personal text that was using it. So, if you choose to use this code, and you remove it, you should send a mass PM/Email to all members and instruct them to remove the "Censor" word from their personal text.