Archive for the 'Scripts' Category

VBulletin Hack: Display Random Logo

This hack will randomly change the forum logo for users randomly every (images/1000) times.
If you have five images then there is a 5 in 1000 or 1 in 200 chance the user will see a “changed” logo.

It usually freaks people out and is a lot of fun.
Works on vBulletin 3.6 and above.

You will need to edit the image url’s as you need. For examples I added in 3 images named logo_random1.jpg through logo_random3.jpg

//random logo hack 1.0, created by jason volk <jason@teknidude.com>
$rnd_pics = Array(
  "/forums/misc/skin/logo_random1.jpg",
  "/forums/misc/skin/logo_random2.jpg",
  "/forums/misc/skin/logo_random3.jpg",
  );
//pick random number
if (($rnd_i=rand(0,1000))<count($rnd_pics))
  $stylevar['titleimage']=$rnd_pics[$rnd_i];
unset($rnd_i,$rnd_pics);  //clear used vars

WordPress Shortcode: Display the post modified time [moddate]

This shortcode will display the post’s last modified timestamp. By default it will display the timestamp in the date & time format that you specify in your blog settings.

If you wish to change it you can use the format=”” option to display the date and time any way you want. (Examples: May 4, 2010 6:41 pm or 2010/05/04 18:41 etc…)
Visit the php date() function page for information on different formats.

Just insert the following code to the bottom of your functions.php file.

function jason_moddate($atts) {
	global $post;
	extract(shortcode_atts(array('format' => get_option("date_format") . " " . get_option("time_format")), $atts));
	return date($format, strtotime($post->post_modified));
}
add_shortcode('moddate', 'jason_moddate');

Now you can use [moddate] anywhere inside your posts or pages:

This post was last modified on [moddate]

Will get you:

This post was last modified on May 5, 2010 2:08 am

Format Examples:

Display just the date:

[moddate format="Y-M-D"]
2010-May-Wed

Display just the time:

[moddate format="h:i:s a"]
02:08:40 am

Combine them together for a full timestamp:

[moddate format="Y-M-D h:i:s a"]
2010-May-Wed 02:08:40 am

Created on WordPress version 2.9.2