MyBB Community Forums

Full Version: Random Smilies
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to display random smilies on the postbit ?
You will have to go plugin hunting. I know for sure you are able to do it with a simple rotation script.
Ive got it guys and it works a treat Smile

Edit : inc/functions.php

Find :
reset($smiliecache);

-----------------------

Add Below :

function custom_shuffle($my_array = array()) {
$copy = array();
while (count($my_array)) {
// Random Smilies By Andy
$element = array_rand($my_array);
// http://www.persiandc.ir
$copy[$element] = $my_array[$element];
//www.persiandc.ir/forums
unset($my_array[$element]);
}
return $copy;
}
$smiliecache = custom_shuffle($smiliecache);
(2010-05-30, 09:51 PM)dunlop03 Wrote: [ -> ]Ive got it guys and it works a treat Smile

Edit : inc/functions.php

Find :
reset($smiliecache);

-----------------------

Add Below :

function custom_shuffle($my_array = array()) {
$copy = array();
while (count($my_array)) {
// Random Smilies By Andy
$element = array_rand($my_array);
// http://www.persiandc.ir
$copy[$element] = $my_array[$element];
//www.persiandc.ir/forums
unset($my_array[$element]);
}
return $copy;
}
$smiliecache = custom_shuffle($smiliecache);

Very nice, you could post that as an tutorial as I am sure other people will like to know how to randomize their smiles.
What does this do exactly? Couldn't figure it out myself.
(2010-05-30, 10:32 PM)faviouz Wrote: [ -> ]What does this do exactly? Couldn't figure it out myself.
It randomizes the smileys you see the the box when posting a post. Every time you refresh the page the smileys are in an different order.
Displays random smilies in the postbit.
hmm I see, sounds interesting. But not really useful I guess. Any reason why you would want this? Toungue
(2010-05-30, 10:42 PM)faviouz Wrote: [ -> ]hmm I see, sounds interesting. But not really useful I guess. Any reason why you would want this? Toungue
So that all the smileys you have added get a chance to be displayed in the smilies box. Now only the first 20 smileys are displaced and almost no one uses the other smileys that you can select from when you click the get more link.
Oh I see, that makes sense.

Not something I would change a core file for, though. Maybe a plugin.