vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   April Fools Joke (https://vborg.vbsupport.ru/showthread.php?t=260714)

steven s 04-01-2011 12:26 AM

Quote:

Originally Posted by SVTCobraLTD (Post 2179594)
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)

kylek 04-01-2011 12:30 AM

StevenS beat me to the reply.

steven s 04-01-2011 12:38 AM

Quote:

Originally Posted by kylek (Post 2179599)
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.

SVTCobraLTD 04-01-2011 12:39 AM

Awesome.

Did you have to resize all the images or will it do it auto?

steven s 04-01-2011 01:02 AM

Quote:

Originally Posted by SVTCobraLTD (Post 2179602)
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.

SVTCobraLTD 04-01-2011 01:28 AM

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?

kylek 04-01-2011 01:49 AM

Quote:

Originally Posted by SVTCobraLTD (Post 2179608)
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?

SVTCobraLTD 04-01-2011 02:01 AM

Quote:

Originally Posted by kylek (Post 2179619)
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"

RickyG 04-01-2011 10:51 AM

thanks!!!

TheComputerGuy 04-01-2011 12:49 PM

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!


All times are GMT. The time now is 01:59 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.02103 seconds
  • Memory Usage 1,744KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete