[paidaccount] [smooth sailing] Randomized User Pictures

Apr 12, 2006 20:05


Paid Accounts OnlyThe following tutorial requires creating and editing a custom style, which in turn requires a paid, permanent, or early adopter account. Please read What are the paid account benefits? and How do I buy a paid account? to learn about the paid account benefits and how to buy a paid account.
This tutorial explains how to randomise 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.livejournal.com/userpic/######/######"; $pic[size($pic)]="http://www.livejournal.com/userpic/######/######"; $pic[size($pic)]="http://www.livejournal.com/userpic/######/######"; $pic[size($pic)]="http://www.livejournal.com/userpic/######/######"; $pic[size($pic)]="http://www.livejournal.com/userpic/######/######"; $pic[size($pic)]="http://www.livejournal.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.livejournal.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.
Additional References:
  • What are the different S2 layer types?
  • S2 View Types

  • Originally based on coding from dianna_wills, original tutorial written by aajwind. Converted into a Smooth Sailing tutorial by draconid.

    randomized userpics, paid accounts only, - smooth sailing

    Previous post Next post
    Up