Post by SubDevo on May 16, 2010 15:43:36 GMT -8
Avatar Anywhere by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.
This code allows you to place the avatar (of the member viewing your forum) anywhere you want!
If the visitor is not a member or doesn't have an avatar, it will show a default avatar (you provide).
Oh, almost forgot! The avatar is clickable and links to your profile!
Simply place this line wherever you wish for the member avatar to appear.
<span id="my_avatar"></span>
This code is great for you sidebar users!
Use this code with my Member Information Anywhere code to create a member cell in your side tables!
Like this:
Enjoy!!!
SubDevo
Variables:
var defAv="URL TO IMAGE"; // Default Avatar URL
Enter the URL to your default avatar image here.
If you don't use one, no error will occur. It just won't show the avatar...
Note:
This code uses cookies to store the URL of the member's avatar, once they view their profile. Until then, the default avatar is used. Of course, if the member deletes their cookies, the default avatar is shown again...
Location: Global Footer
<script type="text/javascript">
/* Avatar Anywhere by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
var defAv="URL TO IMAGE"; // Default Avatar URL
var k=location.href,n=document.images,x=-1,isG=(pb_username=="Guest")?1:0;
if(/action=viewprofile$/.test(k)||(/profile&user=(.+?)$/.test(k)&& RegExp.$1==pb_username)){
while(n[++x]){
if(n[x].alt=="[avatar]"){
document.cookie=pb_username+"_avatar="+n[x].src+"@; expires=Sat, 17 Jan 2050 12:12:12 UTC; path=/"; break;
}}} n=document.getElementById("my_avatar");
k=(new RegExp(pb_username+"_avatar=(.+?)@","i").test(document.cookie)&& !isG)?RegExp.$1:defAv;
if(n&&k.indexOf("http:")==0){ k="<img border='0' alt='View Profile' src='"+k+"'/>";
n.innerHTML=(isG)?k:"<a href='index.cgi?action=viewprofile' title='View Profile'>"+k+"</a>";
}
</script>
EDIT 6/09/2011:
Code updated to support multiple accounts. The avatar will now change when the user switches to another account on the same forum.
Tested in IE, FF, Opera, Safari and Chrome.
This code allows you to place the avatar (of the member viewing your forum) anywhere you want!
If the visitor is not a member or doesn't have an avatar, it will show a default avatar (you provide).
Oh, almost forgot! The avatar is clickable and links to your profile!
Simply place this line wherever you wish for the member avatar to appear.
<span id="my_avatar"></span>
This code is great for you sidebar users!
Use this code with my Member Information Anywhere code to create a member cell in your side tables!
Like this:
Enjoy!!!
SubDevo
Variables:
var defAv="URL TO IMAGE"; // Default Avatar URL
Enter the URL to your default avatar image here.
If you don't use one, no error will occur. It just won't show the avatar...
Note:
This code uses cookies to store the URL of the member's avatar, once they view their profile. Until then, the default avatar is used. Of course, if the member deletes their cookies, the default avatar is shown again...
Location: Global Footer
<script type="text/javascript">
/* Avatar Anywhere by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
var defAv="URL TO IMAGE"; // Default Avatar URL
var k=location.href,n=document.images,x=-1,isG=(pb_username=="Guest")?1:0;
if(/action=viewprofile$/.test(k)||(/profile&user=(.+?)$/.test(k)&& RegExp.$1==pb_username)){
while(n[++x]){
if(n[x].alt=="[avatar]"){
document.cookie=pb_username+"_avatar="+n[x].src+"@; expires=Sat, 17 Jan 2050 12:12:12 UTC; path=/"; break;
}}} n=document.getElementById("my_avatar");
k=(new RegExp(pb_username+"_avatar=(.+?)@","i").test(document.cookie)&& !isG)?RegExp.$1:defAv;
if(n&&k.indexOf("http:")==0){ k="<img border='0' alt='View Profile' src='"+k+"'/>";
n.innerHTML=(isG)?k:"<a href='index.cgi?action=viewprofile' title='View Profile'>"+k+"</a>";
}
</script>
EDIT 6/09/2011:
Code updated to support multiple accounts. The avatar will now change when the user switches to another account on the same forum.