How to Add Default Avatar & Signature to vBulletin without Modifications

vBulletin LogoI used to use two modifications (or plugins / addons) on vB for default avatars & default signatures, but then I decided to limit the use of mods & uninstalled those two. Still I wanted to keep the features.

It just need a little messing with the templates & their PHP codes to make vB give a user who has no avatar / signature a default one you (the admin) choose. Here are the steps

Note: This involves changing PHP codes, so be very careful especially if the code in your templates looks different than what I ask you to find. Also if you get warnings from vBulletin when trying to save the modified templates Do NOT save them, that can break your forum’s display!

1. Find out the template to edit

For both siggy & avators (like some like to call them), the edits should be done in the postbit template of your theme (or style). To access it, go to Styles & Templates > Style Manager, this will list the styles installed in your forum. In the drop down menu right to the theme you want to edit choose Edit Templates.

In the templates list on the left select Postbit Templates » & click the Expand/Collapse button on the right to expand it. Now select the postbit template in the list & click either the Customize button (if this is the 1st time you edit it) or the Edit button.

2. Edit the codes for avatars

Note: You have to have already the image you want as avatar uploaded to the world wide web, it doesn’t have to be on your server.

After you clicked the Customize or Edit button, you must be now staring at the codes inside postbit, look for these lines (there's a Find button to help you find 'em):

<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>

We wil add an <else /> & then the code for the default avatar before the ending </if> tag, in short replace the code you see above with this one:

<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 />
<td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="http://somesite.com/default-avatar.png" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td>
</if>

Obviously you need to replace the link to the image with yours. Then hit the Save and Reload button; go see the new avatars on the forum now ;)

3. Codes & replacements for signatures

OK, you could just add an <else /> & post the desired default siggy after, but I think there’s a better way

a. Creating a Replacement Variable for the signature content

Before you start editing postbit, go to Styles & Templates > Replacement Variable Manager (better to open it in a new browser tab). Click the [Add New Replacement Variable] link beside the theme we are editing.

In the Search for Text field give your variable a name you’d never use except for it, something long with symbols in it is the best, like @mydefaultsiggy@.

Now in the Replace with Text box, add the content of the siggy, the same content you’d put if you were editing the signature in UserCP except that you’ll be using HTML, not bbCode.

Save the new variable.

b. Editing the codes

OK, now back to postbit, find these codes in it:

<if condition="$post['signature']">
<!-- sig -->
<div>
__________________<br />
$post[signature]
</div>
<!-- / sig -->
</if>

Replace with:

<if condition="$post['signature']">
<!-- sig -->
<div>
__________________<br />
$post[signature]
</div>
<!-- / sig -->
<else />
<!-- sig -->
<div>
__________________<br />
@mydefaultsiggy@
</div>
<!-- / sig -->
</if>

Replace @mydefaultsiggy@ with the name you’ve chosen for your variable & save the template. Now every post without a signature should have the default one :)

The advantage from creating the replacement variable is that later if you want to change the signature you just need to edit the variable & not the postbit temlpate.

Comments ( 3 )

  • great post , installed ! , thank u

    but i had a problem that when the user make a signature for himself , it appears only in the new posts !

    and his own old post still have the default signature that i created !

    is there anyway to overcome this problem ??

    any help will be very appreciated

  • Hello,

    When you create a post on vB there’s a checkbox to tick & choose whether to attach signature or not to the post. When a user has no signature, that checkbox is unchecked, which means that when they finally create a signature they will attach it only to the new posts. If they want to attach it to the old posts, they will have to go edit every post & tick that checkbox. I don’t know of another way unfortunately, maybe some SQL query could do it.

    My modification will just add a signature to any post that hasn’t one, it’s not the cause of your problem.

Comments are closed.