ScotchBonnet
Scotchsour's Place for Layouts, Codes, Icons, Mood Themes...
 
Commenting To 
 
22nd-Dec-2007 09:17 pm - (Paid) Randomized User Pictures (SS/RR)
This is for my own purpose but it might be useful to somebody else.



This tutorial explains how to randomize user picture which displays in the profile box in the sidebar. The code to do this will override the Page::lay_print_sidebar_profile(). You will need to place the coding in a theme layer. If you already have a theme layer for the Smooth Sailing style, you can edit it to include this code. Otherwise, you need to create one as explained in the Theme Layer tutorial.

You will need to copy the following code into your theme layer, making sure to include everything:

function Page::lay_print_sidebar_profile() {

var string[] pic;

$pic[size($pic)]="http://www.insanejournal.com/userpic/######/######";
$pic[size($pic)]="http://www.insanejournal.com/userpic/######/######";
$pic[size($pic)]="http://www.insanejournal.com/userpic/######/######";
$pic[size($pic)]="http://www.insanejournal.com/userpic/######/######";
$pic[size($pic)]="http://www.insanejournal.com/userpic/######/######";
$pic[size($pic)]="http://www.insanejournal.com/userpic/######/######";

var int randpic;
$randpic = rand(0, ((size $pic) - 1));

$this->lay_print_sidebox_top($*text_sidebox_profile_title);
"""


$*text_sidebox_profile_userlabel$.journal

$*text_sidebox_profile_namelabel$.journal.name

""";
if ($*text_sidebox_profile_info!="") { """
"""; print $*text_sidebox_profile_info; """
"""; }
"""

""";
$this->lay_print_sidebox_bottom();
}



In the above code, you need to replace http://www.insanejournal.com/userpic/######/###### (for each) with the user pictures that you'd like to be randomized. Please notice that, though six user pictures are used here, there is no maximum or minimum to the number of user pictures that you can use.

Once you have finished adding the code above, you can save your theme layer by clicking on the "Save & Compile" button at the top of the screen. Your changes will not take effect until you apply your theme layer by selecting it on the Customize Journal page.

Originally posted: Here
chipper
Comment Form 
From:
( )Anonymous- this user has disabled anonymous posting.
( )OpenID
Username:
Password:
Don't have an account? Create one now.
Subject:
No HTML allowed in subject
  
Message:
 
Notice! This user has turned on the option that logs your IP address when posting.
Code by masterslacker. Fiddled by userinfoscotchsour. This page was loaded on May 13th 2024, 5:04 pm GMT.