Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2006, 02:14 AM
The Ottoman The Ottoman is offline
 
Join Date: Nov 2005
Posts: 86
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Avatar based on Forum

I'm looking to see if anyone can create a hack that would allow a user to assign an secondary avatar that is displayed in another forum.

For example, if I were to have an RPG forum, the members could use their RPG character as the avatar in there, while having their "regular" avatar throughout the rest of the site.
Reply With Quote
  #2  
Old 11-27-2006, 07:49 AM
DigitalDesktops DigitalDesktops is offline
 
Join Date: Mar 2003
Location: Scotland, UK
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After searching the entire vBulletin.org forums for exactly the same thing, and finidng nothing, I decided to make this myself. N.b. This is a template modification at the moment. I am working on a plugin but it wont be done for ages as it isn't high on my priority list at the moment.

First, you need to create a new User Profile Field. It is to be a text box that users can put a URL to an image in that will eventually be their own custom RPG avatar. Note down the field name for future use.

Then, go to the style you want these changes to show in and edit templates. Find postbit or postbit_legacy. Then find the following code:

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[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
				</div>
			</if>
Replace it with this code:
Code:
<if condition="$show['avatar']">
	<if condition="in_array($thread[forumid], array(42, 70, 43, 149, 44, 146, 103, 145, 52, 65, 82, 73, 77, 74, 47, 137, 138, 139, 50, 108, 177, 176, 178, 143, 101, 164, 63,  175, 174,  147, 144, 182))">
		<if condition="$post['field24']">
			<div class="smallfont">
				&nbsp;<br />
			<a href="member.php?$session[sessionurl]u=$post[userid]">
			<img src="$post[field24]" $post[avwidth] $post[avheight] alt="<phrase 1="$post[username]">$vbphrase[xs_avatar]</phrase>" border="0" /></a>
			</div>
		<else />
			<div class="smallfont">
				&nbsp;<br />
			<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>
			</div>
		</if>
	<else />
		<div class="smallfont">
			&nbsp;<br />
		<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>
		</div>
	</if>
</if>

Look at the above code, you can see a long list of numbers in an array. Those numbers are the forum ids for the forums you want the avatars to change in. Adjust those numbers for the forum ids that are on your forums that you want the avatars to change in.
Underneath that code there is an if conditional with "field24" listed. Replace the number 24 with whatever number your new custom user profile field is. Then do the same for the field24 part further down which is the image url for the avatar to use. And then you are done.
Make sure to do the template changes in any styles you want this to work in. I have masses of templates on my forums so it took a while, but luckily it is just a copy and paste job and only in one template.
Reply With Quote
  #3  
Old 12-25-2007, 04:07 AM
The Ottoman The Ottoman is offline
 
Join Date: Nov 2005
Posts: 86
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That sooooooo worked.


Thanks dude.
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 10:04 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05947 seconds
  • Memory Usage 2,180KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete