The S2 HowTo Journal

Tips, Tricks, and Tutorials for Basic S2 Customization

Previous Entry Share Next Entry
[paidaccount] [gradient strip] Hiding particular users' posts on the Friends page
howto_user wrote in s2howto
Paid Accounts Only
The 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 requires the creation of a theme layer. If you already have a theme layer, you will need to edit it and add the code below. If you do not have a theme layer, you will need to create one by following the instructions in the Theme Layer tutorial.

In the Gradient Strip layout, you can add a Usenet-style "killfile" to your Friends page by overriding the FriendsPage::print_body function. This will allow you to hide entries from particular users when viewing your Friends page.

You can add a killfile to your Friends page by using the following code:

function FriendsPage::print_body {
   $this->lay_print_nav();
   var string kill_list = " exampleusername1 exampleusername2 exampleusername3 ";
   foreach var Entry e ($.entries) {
     if (not $kill_list->contains(" $e.poster.username ")) {
       $this->print_entry($e);
     }
   }
   $this->lay_print_nav();
}

Replace exampleusername1, exampleusername2, and exampleusername3 with the names of users whose entries you wish to hide. You can include fewer or more than three usernames, but be sure to keep a space between the usernames.

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.

Contributed by alsatia, based on a tutorial by pocketnovel and camomiletea.


Comments Disabled:

Comments have been disabled for this post.

?

Log in

No account? Create an account