Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 04-01-2011, 12:26 AM
steven s's Avatar
steven s steven s is offline
 
Join Date: Aug 2004
Location: Greenville, SC
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SVTCobraLTD View Post
How do you make a plugin?
Plugins & Products -> Add New Plugin
Product = vBulletin
Hook Location = postbit_display_complete
Title = Random Avatar
Execution Order = 5
Plugin PHP Code =
PHP Code:
$newavatar rand(1,20);
$this->post['avatarurl'] = "avatarlocation/image_$newavatar.gif"
Save

avatarlocation is replaced with the path of your avatars.
I uploaded a bunch of avatars to a directory called funavatars.
Each avatar needs to begin with a number.
In this example, 1-20. image_x (x is the random number)
Reply With Quote
  #12  
Old 04-01-2011, 12:30 AM
kylek kylek is offline
 
Join Date: Oct 2003
Location: British Columbia, Canada
Posts: 798
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

StevenS beat me to the reply.
Reply With Quote
  #13  
Old 04-01-2011, 12:38 AM
steven s's Avatar
steven s steven s is offline
 
Join Date: Aug 2004
Location: Greenville, SC
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kylek View Post
StevenS beat me to the reply.
I was typing very fast.

I actually did a variation on this.
PHP Code:
$directory rand(1,4);
$newavatar rand(1,50);
$this->post['avatarurl'] = "images/funavatars/$directory/$newavatar.jpg"
I have 4 directories of avatars of 50 avatars each.
funavatars
..1
..2
..3
..4

Now I only wish I could add a conditional so it starts at midnight and ends at 11:59PM the user's time.
Reply With Quote
  #14  
Old 04-01-2011, 12:39 AM
SVTCobraLTD SVTCobraLTD is offline
 
Join Date: Jul 2007
Location: PA
Posts: 841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome.

Did you have to resize all the images or will it do it auto?
Reply With Quote
  #15  
Old 04-01-2011, 01:02 AM
steven s's Avatar
steven s steven s is offline
 
Join Date: Aug 2004
Location: Greenville, SC
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SVTCobraLTD View Post
Awesome.

Did you have to resize all the images or will it do it auto?
I downloaded avatars that were all 100x100px. It won't resize the avatars.
Reply With Quote
  #16  
Old 04-01-2011, 01:28 AM
SVTCobraLTD SVTCobraLTD is offline
 
Join Date: Jul 2007
Location: PA
Posts: 841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im missing something, no avatar is showing when i activate plugin.

images are in forums/customavatars/rice/

images are named 1_image_newavatar.jpg

plugin code is:
Code:
$newavatar = rand(1,32);
$this->post['avatarurl'] = "customavatars/rice/image_$newavatar.jpg";
But nothing. What am I over looking?
Reply With Quote
  #17  
Old 04-01-2011, 01:49 AM
kylek kylek is offline
 
Join Date: Oct 2003
Location: British Columbia, Canada
Posts: 798
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SVTCobraLTD View Post
Im missing something, no avatar is showing when i activate plugin.

images are in forums/customavatars/rice/

images are named 1_image_newavatar.jpg

plugin code is:
Code:
$newavatar = rand(1,32);
$this->post['avatarurl'] = "customavatars/rice/image_$newavatar.jpg";
But nothing. What am I over looking?
Could be your image name, shouldn't they be image_1newavatar.jpg, image_2newavatar.jpg, etc?
Reply With Quote
  #18  
Old 04-01-2011, 02:01 AM
SVTCobraLTD SVTCobraLTD is offline
 
Join Date: Jul 2007
Location: PA
Posts: 841
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kylek View Post
Could be your image name, shouldn't they be image_1newavatar.jpg, image_2newavatar.jpg, etc?
That did not seem to make a difference

--------------- Added [DATE]1301629440[/DATE] at [TIME]1301629440[/TIME] ---------------

Issue was it needs to read:
Code:
$newavatar = rand(1,32);
$this->post['avatarurl'] = "/forums/customavatars/rice/image_$newavatar.jpg";
Image has to be "image_#.jpg"
Reply With Quote
  #19  
Old 04-01-2011, 10:51 AM
RickyG RickyG is offline
 
Join Date: Jan 2008
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks!!!
Reply With Quote
  #20  
Old 04-01-2011, 12:49 PM
TheComputerGuy's Avatar
TheComputerGuy TheComputerGuy is offline
 
Join Date: Oct 2001
Location: TX
Posts: 580
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Some people don't have avatars, so it's not quite as funny as I'd hope.

But a serious bunch of guys with care bear avatars is funny stuff!
Reply With Quote
Reply

Thread Tools
Display Modes

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:23 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.04044 seconds
  • Memory Usage 2,257KB
  • 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
  • (3)bbcode_code
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)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