vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Avatar based on Forum (https://vborg.vbsupport.ru/showthread.php?t=121535)

The Ottoman 07-19-2006 02:14 AM

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.

DigitalDesktops 11-27-2006 07:49 AM

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.

The Ottoman 12-25-2007 04:07 AM

That sooooooo worked.


Thanks dude.


All times are GMT. The time now is 06:49 AM.

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.00975 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete