Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Random Rotating Avatar for specific users Details »»
Random Rotating Avatar for specific users
Version: 1.00, by Michael Morris Michael Morris is offline
Developer Last Online: Jun 2009 Show Printable Version Email this Page

Version: 3.5.0 RC2 Rating:
Released: 09-07-2005 Last Update: Never Installs: 21
 
No support by the author.

This little plug in allows you to have a random avatar instead of a constant one. The avatar of the user(s) you do this to will change each time their postbit is called. This will allow you as an admin, and those you choose (usually mods) to stand out a little more. Be cautious on using this too liberally unless you theme the avatars (all by the same artist - all of the same character, etc.).

Start out of course by creating the images that you want to cycle through and place them in the same directory, numbering them sequenctially -- 1.jpg, 2.jpg, 3.jpg, 4.jpg etc.

Now go to the plug in manager and click "Add New Plug in." Name it "John Doe's avatar" or some such. The hook location is "postbit_display_complete"

The code is as follows:

PHP Code:
if ($this->post['userid'] == Y)
{
$randomavatar rand(1,X);
$this->post['avatarurl'] = "http://yourdomain/path_to_your_directory/$randomavatar.jpg";

X is the upper most picture you made - so if your highest picture is 22.jpg you would use rand(1,22)

Y is your user id (or the id of the user you want this to apply to.

If you want to do this to multiple users then put multiple instances of this code in the same plugin to save on queries.

Make sure to keep your avatar set to something despite this plug in -- if you don't vbulletin will think there is no avatar and set the $show['avatar'] variable to false. While you could override this you'd need to check the logged in user's preferences to see if they even want to see avatars. It's just a whole lot easier to avoid the issue by making sure that vbulletin has an avatar on file for the user this plugin affects - this plugin will then switch the avatar url after vbulletin has made all it's normal determinations.

Tested on RC2, should work on all versions.

Show Your Support

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

Comments
  #2  
Old 09-08-2005, 06:01 PM
TCattitude's Avatar
TCattitude TCattitude is offline
 
Join Date: Oct 2004
Location: Chile
Posts: 195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=83252" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=83252</a>
Reply With Quote
  #3  
Old 09-08-2005, 06:24 PM
jugo jugo is offline
 
Join Date: Feb 2004
Location: Reading your emails.
Posts: 573
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

good idea but this has potential to get really messy.

good starting point though.
Reply With Quote
  #4  
Old 09-08-2005, 07:53 PM
Cyricx Cyricx is offline
 
Join Date: Aug 2002
Location: Missouri
Posts: 1,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm couldn't you make it a lil less messy though?

Add a new user field "randomavatar" with the yes/no code

and a new user field of "maxrandavatar"

Code:
if ($this->post['randomavatar'] == 1) // meaning yes
{ 
$randomavatar = rand(1,$post['maxrandavatar']); 
$this->post['avatarurl'] = "http://yourdomain/forumdirectory/images/avatars/random/$post['userid']/$randomavatar.jpg"; 
}
Then you'd create a new folder in the avatars folder called "random" and then add new folders of that users userid with the avatars in there.

Course you'd go through the admin users panel to turn it on and set how many images it randomizes through.

That's my input

Awesome idea though, will definately be implementing this in some form for premium members
Reply With Quote
  #5  
Old 09-09-2005, 01:40 AM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TCattitude
There is no zip file because this hack needs to be partially rewritten before being deployed. I suppose a complicated interface for the admincp could be written to avoid this need, but I don't have the time to do it.

And BTW - if the mods and admins need your help, I'm sure they'll let you know.
Reply With Quote
  #6  
Old 09-09-2005, 01:48 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You migth want to make the plug-in for this as it would be considered a code mod without, it wouldn't it?
Reply With Quote
  #7  
Old 09-09-2005, 01:52 AM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo
You migth want to make the plug-in for this as it would be considered a code mod without, it wouldn't it?
I'm not sure - you don't need to upload anything. You just need to edit the phpcode in the first post, go to the admincp and click "Add new plug in", and paste the code in the code field.

I could make an xml file, but that only adds an extra step since the user will still have to edit the plug in and provide the path to the images directory where the random images are, the maximum rand seed and the userid that it is to affect before it will work correctly.
Reply With Quote
  #8  
Old 09-09-2005, 01:58 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A simple admin CP setting would take care of that.
Reply With Quote
  #9  
Old 09-09-2005, 01:05 PM
Thomas Heretic Thomas Heretic is offline
 
Join Date: Sep 2003
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod. I use one slightly different that doesn't require naming of the files in any specific method, but yours will run faster.
Reply With Quote
  #10  
Old 09-10-2005, 09:24 PM
Wordplay Wordplay is offline
 
Join Date: Nov 2001
Location: Dengoku
Posts: 864
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anybody got a hack coming out with random avatars for all users within specific usergroups?

thought that would be cool, if all users had 1-5 rotating avatars. number of rotating avatars set by usergroup options.
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 04:57 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.04483 seconds
  • Memory Usage 2,295KB
  • Queries Executed 25 (?)
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)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete