PDA

View Full Version : Forum Display Enhancements - If User Hasn't Got An Avatar Show Default Avatar With Link To Set One


1Unreal
03-02-2009, 10:00 PM
https://vborg.vbsupport.ru/external/2009/03/52.png

I think that when most of your users have custom avatars set it makes your forum look alot better as your user has shown some sort of commitment to it. Using this small template hack it will encourage your users to set an avatar and if they haven't give a nice alternative.

Also, its worth noting that the link to set a new avatar will only be shown to the user, not everyone using the forum.

Firstly, I will show you the one with the default avatar included. Then another version without it.

Ok, so open up the style manager and open the postbit for what ever style you are using. Then where you want your avatar to display paste this code:

<if condition="$bbuserinfo[showavatars]">
<img src="DefaultAvatarURL" alt="" border="0" />
<br />
<if condition="$bbuserinfo['userid'] == $post[userid]">
<a href="profile.php?$session[sessionurl]do=editavatar">Set Avatar</a>
</if>

Remember to change this src="DefaultAvatarURL" to whatever your image URL is.

So, this will show the default avatar and a link below it to set their own custom avatar.

This version will not show the default avatar, just the link to set one. Do the same as the first step just paste in this code instead.

<if condition="$bbuserinfo[showavatars]">
<if condition="$bbuserinfo['userid'] == $post[userid]">
<a href="profile.php?$session[sessionurl]do=editavatar">Set Avatar</a>
</if>

DobieGillis?
03-03-2009, 02:30 PM
nice. What hack do you have that displays the activity. longevity under the AV? I like that, too

1Unreal
03-03-2009, 03:06 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=177366" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=177366</a>

Its for vB 3.7 but its working fine on 3.8.

DobieGillis?
03-03-2009, 03:12 PM
https://vborg.vbsupport.ru/showthread.php?t=177366

Its for vB 3.7 but its working fine on 3.8.

thanks!

macc
03-03-2009, 04:11 PM
hello!

i have like this in my postbit template <!-- user info -->
<table cellpadding="0" cellspacing="$stylevar[cellpadding]" border="0" width="100%">
<tr>
<if condition="$show['avatar']"><td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if>
<td nowrap="nowrap">
<div id="postmenu_$post[postid]">
<if condition="$show['profile']">
<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
$post[onlinestatus]
<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>


where to put your code (this one with image)?
i will have this image like is when users-members put own avatars.(their own after select will change default no-avatar image)
regards

macc

1Unreal
03-03-2009, 04:13 PM
Try this:

<!-- user info -->
<table cellpadding="0" cellspacing="$stylevar[cellpadding]" border="0" width="100%">
<tr>
<if condition="$bbuserinfo[showavatars]">
<img src="DefaultAvatarURL" alt="" border="0" />
<br />
<if condition="$bbuserinfo['userid'] == $post[userid]">
<a href="profile.php?$session[sessionurl]do=editavatar">Set Avatar</a>
</if>
</if>
<td nowrap="nowrap">
<div id="postmenu_$post[postid]">
<if condition="$show['profile']">
<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
$post[onlinestatus]
<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>

macc
03-03-2009, 04:17 PM
every avatar is clickable ..and after clik go to userprofile - shoud i will lose this function ?


regards

macc

1Unreal
03-03-2009, 04:55 PM
every avatar is clickable ..and after clik go to userprofile - shoud i will lose this function ?


regards

macc

Firstly the link is only visible to the user without an avatar so that's not an issue. Secondly there's a text link and it's not the avatar you click.

macc
03-03-2009, 05:18 PM
tried your code (few posts above) and get this error message


The conditional on line 38 appears to be missing its end tag (</if>). The template will not function properly unless this is fixed.

some help ?

regards

macc

macc
03-03-2009, 05:25 PM
your code works not - put </if> tag and could not see text and picture is on top-left - see here - http://libar-libar.com/libar/vb/showthread.php?p=3377#post3377


will that be like default avatars pictures to all members like original - and that code change all members avatars ...???
regards

macc

1Unreal
03-03-2009, 05:38 PM
Sorry, I updated it. Try the code again.

macc
03-03-2009, 06:34 PM
hello!

used this code and get image (defaul avatar) to work ... what to do now to get your text - select avatar - to work ?

<!-- user info -->
<table cellpadding="0" cellspacing="$stylevar[cellpadding]" border="0" width="100%">
<tr>
<if condition="$show['avatar']">
<td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td>
<else />
<if condition="$bbuserinfo[showavatars]">
<td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$stylevar[imgdir_misc]/blue.gif" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td>
</if>
</if>

you can see here - http://libar-libar.com/libar/vb/showthread.php?p=3377#post3377

regards

macc

edit: fixed - now works fine!

maccc

TriAxis
03-04-2009, 06:41 AM
Your code listed at the top of this tread did not work for me.

I finally got it to work by using the code that was in one of the reply boxes.

I had to do a bit of editing because it kept showing 2 avatars for all the users that had already picked their avatar. And I was confused in all the extra code about where to put the default image, but I figured it out. As well as making sure clicking the avatar took you to the change avatar area and not to their profile default area.

The bottom line is I did get it to work and I marked installed.