View Full Version : April Fools Joke
SVTCobraLTD
03-21-2011, 02:41 AM
Would this coding still work in vb 3.8.x?
just add something like $newavatar = mt_rand(1, 10); in postbit_display_start hook, (if you have 10 random avatars to display)
and the in the postbit, change the avatar to <img src="avatarlocation/image_$newavatar.gif">
I want to have avatars randomly change.
JacquiiDesigns
03-21-2011, 03:50 AM
This would be kinda kewl. Subscribing...
Paul M
03-22-2011, 10:23 AM
Would this coding still work in vb 3.8.x?
Should do.
valdet
03-30-2011, 10:02 AM
That's what I did last year.
In a hugely replublican/conservative forum, I replaced user avatars, with democrat/liberal politicians and celebrities, with some funny messages as user ranks.
It proved to be a great prank.
Lynne
03-30-2011, 01:58 PM
No need to do any template edits. Just do it all in a plugin:
$newavatar = rand(1,20);
$this->post['avatarurl'] = "avatarlocation/image_$newavatar.gif";
You may want to set the width/height also ( $this->post['avwidth'] = 'width="100"'; etc... )
kylek
03-31-2011, 09:23 AM
Would this work with 4.1.2?
Ellendway
03-31-2011, 01:10 PM
No need to do any template edits. Just do it all in a plugin:
$newavatar = rand(1,20);
$this->post['avatarurl'] = "avatarlocation/image_$newavatar.gif";
You may want to set the width/height also ( $this->post['avwidth'] = 'width="100"'; etc... )
Hey,
it's a plugin, right? What Hook Location I must select?
//edit: Nevermind, is something like this for vb 4???
Lynne
03-31-2011, 02:40 PM
Just use postbit_display_complete.
It's just php, so it works with 3.x and 4.x
Ellendway
03-31-2011, 04:27 PM
Thanks <3
SVTCobraLTD
03-31-2011, 11:59 PM
How do you make a plugin?
steven s
04-01-2011, 12:26 AM
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 = $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
StevenS beat me to the reply.
I was typing very fast.
I actually did a variation on this.
$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
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:
$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
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:
$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
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 1301629440 at 1301629440 ---------------
Issue was it needs to read:
$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!
Lynne
04-01-2011, 04:00 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!
Just set $show['avatars'] to true in the plugin. :)
I've got random avatars and signatures on my site. The users are finding it pretty funny.
vijayninel
04-01-2011, 05:57 PM
Lynnes plugin worked perfectly :P http://www.erodov.com/forums/whats-up-changed-avatars/41140.html
thanks Lynne. ;)
Chimpie
04-01-2011, 06:30 PM
Okay, so how does this need to be written to pull random avatars from avatars already in the database?
--------------- Added 1301686409 at 1301686409 ---------------
I'd also would love a way to flip usernames upside down.
steven s
04-01-2011, 10:36 PM
My members didn't say anything until I mentioned it.
Now they like it.
I may not remove it.
It may actually bring people back to see who their avatar is going to be next. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.