howto_user (howto_user) wrote in s2howto,
howto_user
howto_user
s2howto

[paid accounts only] [Flexible Squares] Removing userpics

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.

Usericons are enabled by default on the Recent Entries view of Flexible Squares, so this tutorial covers how to disable them. It will override the print_entry function. This 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.

Copy and paste the following code into your theme layer to disable usericons in the Recent view only:

function print_entry(Page p, Entry e, Color bgcolor, Color fgcolor)
{	      	
	$e->print_linkbar();
	
	
	# Userpic
	
	var string userpic = "";
	if ($*show_entry_userpic)
	{ 
		if ($p.view == "friends" or $p.view == "entry")
	    {
	        if (defined $e.userpic) 
		     	{
	            $userpic = $userpic + """<img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height"  alt="$e.poster.name" title="$e.poster.name""";
	        		if ($e.poster.username != $e.journal.username)
			        	{
				        	$userpic = $userpic + " in $e.journal.name";
			    		}
			        $userpic = $userpic + "\">";	
	    		}
	    }
	    elseif ($p.journal_type == "C" and $p.view == "recent")
	    {
		    if (defined $e.userpic) 
		     	{
	            $userpic = $userpic + """<img src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height"  alt="$e.poster.name" title="$e.poster.name" />""";
	    		}
	    }    

	}	
	print """
		<div class="subcontent">
		""";				
		if (($p.view == "recent" and $p.journal_type != "C" ) or $p.view == "day")
		{
			print """$userpic""";
		}
		else
		{
			if ($p.view == "recent" and $p.journal_type == "C" )
			{
				"""<div class="userpicfriends" style="background-color: $*entry_bgcolor;">""";
			}
			else
			{
				"""<div class="userpicfriends" style="background-color: $bgcolor;">""";
			}			
			print """$userpic""";
			
				
	# Poster
							
			if ($p.view == "friends" or $p.view == "entry")
			{ 
				var UserLite linkto;
				$linkto = $e.poster;
				#print "$e.poster.username"; 
				"""<br /><a href=\"""" + $linkto->base_url() + "\">";				
				 "<font color=\"$fgcolor\">$linkto.username</font></a>";					
			}
			elseif ($p.journal_type == "C" and $p.view == "recent")
			{	
				var UserLite linkto;
				$linkto = $e.poster;
				#print "$e.poster.username"; 
				"""<br /><a href=\"""" + $linkto->base_url() + "\">";				
				 "$linkto.username</a>";				
			}
			if (($p.view == "friends" or $p.view == "entry") and $e.poster.username != $e.journal.username) 
		    {
					var UserLite linkto;
				$linkto = $e.journal;
				"""<br />[<a href=\"""" + $linkto->base_url() + "\">";				
				 "<font color=\"$fgcolor\">$linkto.username</font></a>]";
			}
			if ($p.view == "recent" and $p.journal_type == "C")
			{
				print "</div>";
			}	
			if ($p.view != "recent" and $p.view != "day")
			{
				print """</div>""";
			}
		}
		
		
	# Date, time, subject
			
			var string time = "";
			$time = $time + """ @ """;
			$time = $time + $e.time->time_format("short");
			var string date = "";
		    $date = $date + $e.time->date_format("long_day");
			"""
			<div class="datesubject"><div class="date">""";
				print $e.time->date_format("%%dd%% %%month%% %%yyyy%%");
				"$time
		   	</div>";
			"""
			<div class="subject">""";
				if ($e.security != "") 
				{
					$e.security_icon->print();
				}
				"""
				$e.subject &nbsp;
			</div>
		</div>
		""";
	   		   		
	 	"""
	 	<div class="entry">
		      <div class="entry_text">""";

                        $e->print_text();
                        print "</div> ";
			
			# Currents
			
			var string currents ="";
			$e->print_metadata();	
		
			# Comments	
		
			"""
			<div class="clear">&nbsp;</div>
			<div class="comments">""";
		     if ($p.view != "entry" or $p.view != "reply") 
		    {
		         $e.comments->print(); 
			} 
		    elseif ($e.comments.enabled) 
		    {
			    $e.comments->print_postlink();
		    }
		    else 
		    {
		        "&nbsp;";
		    }
			"""
			</div>
		</div>
	</div>

	<div class="separator"></div>
	<div class="clear">&nbsp;</div>""";
}

If you want to disable all usericons (ie, the usericons on your Friends page as well as your Recent page), use the following code instead:

set show_entry_userpic = false;

Compile your layer, and it's ready to use. You will need to apply your theme layer via the Customize interface in order for your changes to take effect.

Contributed by dandelion.

Tags: - flexible squares, hiding userpics, paid accounts only, recent entries, removing userpics, userpics
Subscribe

Comments for this post were disabled by the author