Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Remote Avatars Details »»
Remote Avatars
Version: 0.11, by Rawhide Rawhide is offline
Developer Last Online: May 2022 Show Printable Version Email this Page

Version: 3.6.3 Rating:
Released: 11-15-2006 Last Update: Never Installs: 3
Template Edits
Is in Beta Stage  
No support by the author.

This is a template modification for vBulletin 3.6.3 to enable the use of remote or default avatars. It disables the inbuilt avatar handling system and does not allow avatar uploading.

A regular expression is used to prevent html or other code from being used and to prevent the avatar from stretching the page layout. You can set the width and height of the avatar from 20 pixels to 120, if not set the same as the original image, the image will be stretched.

As of this version, v0.1 BETA, only the postbit_legacy is supported. Although it will not be hard to modify it to suit the standard postbit.



Step 1: Create the following 5 User Profile Fields

Title: Avatar
(field6 in my examples)
Profile Field Type: Single-Selection Radio Buttons
Options: Required, Editable
Description: Avatars are small graphics that are displayed under your username whenever you post. This is a global setting that will turn off your avatar altogether or let you choose a default or custom one.
Items per line: 0
Options:
None
Default
Custom

Set Default: Yes
Display Order: (Whatever ends up being 1st)
Field Required: Yes, Always
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Allow user to input their own value for this option: No
Max length of allowed user input: 100
Field Length: 25
Regular Expression:
Which page displays this option?: Options: Other

---

Title: Default Avatar
(field7 in my examples)
Profile Field Type: Single-Selection Menu
Options: Required, Editable
Description: A selection of default avatars.
Set Default: Yes, but no First Blank Option
Display Order: (Whatever ends up being 2nd)
Field Required: Yes, Always
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Allow user to input their own value for this option: No
Max length of allowed user input: 100
Field Length: 25
Regular Expression:
Which page displays this option?: Options: Other

---

Title: Custom Avatar URL
(field8 in my examples)
Profile Field Type: Single-Line Text Box
Options: Editable
Description: Type in the URL to your custom avatar. The URL must start with http:// and the avatar must end in .gif, .jpg or .png. For example: http://www.example.com/avatars/avatar.gif
Default Value:
Max length of allowed user input: 100
Field Length: 50
Profile Field Type: Single-Line Text Box
Display Order: (Whatever ends up being 3rd)
Field Required: No
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Regular Expression: ^http://([A-Za-z0-9/.~_-]+)\.(jpg|gif|png)$|^$
Which page displays this option?: Options: Other

---

Title: Custom Avatar Width
(field9 in my examples)
Profile Field Type: Single-Line Text Box
Options: Required, Editable
Description: Custom avatar width in pixels (20-120, default 80)
Default Value: 80
Max length of allowed user input: 3
Field Length: 3
Profile Field Type: Single-Line Text Box
Display Order: (Whatever ends up being 4th)
Field Required: Yes, Always
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Regular Expression: ^([2-9][0-9]|1[0-1][0-9]|120)$
Which page displays this option?: Options: Other

---

Title: Custom Avatar Height
(field10 in my examples)
Profile Field Type: Single-Line Text Box
Options: Required, Editable
Description: Custom avatar height in pixels (20-120, default 80)
Default Value: 80
Max length of allowed user input: 3
Field Length: 3
Profile Field Type: Single-Line Text Box
Display Order: (Whatever ends up being 5th)
Field Required: Yes, Always
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Regular Expression: ^([2-9][0-9]|1[0-1][0-9]|120)$
Which page displays this option?: Options: Other


Step 2: Create a web accessable folder to house your default avatars.
ie. http://www.example.com/avatars/


Step 3: Name and upload the default avatars. You should not use spaces and I suggest using capital letters to distinguish words. This makes it look nicer later on. All your avatars need to have the same file extension, this is currently .gif but can be changed.
ie. OrangeBanana.gif


Step 4: One per line in the Default Avatar field, type in the names of the uploaded avatars exactly as they are, but without the extension.
ie. OrangeBanana.gif = OrangeBanana


Step 5: In Member Info Templates -> MEMBERINFO
Find:
PHP Code:
<if condition="$show['avatar']">
  <
td><img src="$userinfo[avatarurl]$userinfo[avatarsizealt="<phrase 1="$userinfo[username]">$vbphrase[xs_avatar]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" /></td>
<else />
  <
td>&nbsp;</td>
</if> 
Replace:
PHP Code:
<td>
  <if 
condition="$bbuserinfo[options] & 2 OR $bbuserinfo['userid'] == 0">
    <if 
condition="$userinfo['field6'] == 'Default' AND $userinfo['field7']">
      <
img src="http://www.example.com/avatars/$userinfo[field7].gif"  alt="$post[field7]style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" />
    </if>
    <if 
condition="$userinfo['field6'] == 'Custom' AND $userinfo['field8'] AND $userinfo['field9'] AND $userinfo['field10']">    
      <
img src="$userinfo[field8]alt="" width="$userinfo[field9]height="$userinfo[field10]style="border:1px solid $stylevar[tborder_bgcolor]; border-top:none" />
    </if>
  </if>
&
nbsp;</td
Be sure to replace http://www.example.com/avatars/ with your default avatar location and update all custom fields!


Step 6: In Postbit Templates - > postbit
Skip this step or make your own modification based on my postbit_legacy example. I will include this step later.
The code you want to replace is here:
PHP Code:
<if condition="$show['avatar']"><td class="alt2"><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]$post[avwidth$post[avheightalt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a></td></if> 

Step 7: In Postbit Templates - > postbit_legacy
Find:
PHP Code:
<if condition="$show['avatar']">
  <
div class="smallfont">
  &
nbsp;<br /><a href="member.php?$session[sessionurl]u=$post[userid]"><img src="$post[avatarurl]$post[avwidth$post[avheightalt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
  </
div>
</if> 
Replace:
PHP Code:
<if condition="$bbuserinfo[options] & 2 OR $bbuserinfo['userid'] == 0">
  <if 
condition="$post['field6'] == 'Default' AND $post['field7']">
    <
div class="smallfont">
    &
nbsp;<br />
    <
img src="http://www.example.com/avatars/$post[field7].gif"  alt="$post[field7]border="0" />
  </
div>
  </if>
  <if 
condition="$post['field6'] == 'Custom' AND $post['field8'] AND $post['field9'] AND $post['field10']">    
    <
div class="smallfont">
    &
nbsp;<br />
    <
img src="$post[field8]alt="" border="0" width="$post[field9]height="$post[field10]/>
    </
div>
  </if>
</if> 
Be sure to replace http://www.example.com/avatars/ with your default avatar location and update all custom fields!


Step 8: Run these SQL queries

UPDATE userfield
SET field6 = 'None'
WHERE field6 = ''

UPDATE userfield
SET field7 = 'Avatar'
WHERE field7 = ''
(Replace Avatar with the first default avatar you have in the list)

UPDATE userfield
SET field9 = '80'
WHERE field9 = ''

UPDATE userfield
SET field10 = '80'
WHERE field10 = ''



Step 9: TEST! TEST! TEST!



Revision history:
0.1 BETA
Original release

0.11 BETA
Bugfix: Regular expression for Custom Avatar Width and Height not allowing sizes 100-109. New expression: ^([2-9][0-9]|1[0-1][0-9]|120)$



Special thanks go to Jake Bunce and Viper007Bond who both helped when I was stuck.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-23-2008, 01:45 AM
001 001 is offline
 
Join Date: Feb 2007
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It no longer works for 3.7.3.
Reply With Quote
  #13  
Old 09-23-2008, 06:09 AM
NolF's Avatar
NolF NolF is offline
 
Join Date: Nov 2006
Location: You don't wanna know
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have a look at https://vborg.vbsupport.ru/showthread.php?t=180162
I havent test it with 3.7.3 but I see no reason why it shouldn't work It's been working perfectly on my site for months now and no problems ^^
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:14 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04746 seconds
  • Memory Usage 2,264KB
  • Queries Executed 19 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete