56 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<%~--
 | 
						|
 | 
						|
This page is included almost everywhere in the templates to display a username.
 | 
						|
Things like linking, group highlighting, buddy highlighting, etc. are handled
 | 
						|
here, in one central place, instead of being duplicated all over the place.
 | 
						|
The general usage is, instead of something like:
 | 
						|
 | 
						|
... <a href="<%GForum::SEO::url(type => 'profile', id => $user_username)%>"><%user_username%></a> ...
 | 
						|
 | 
						|
you do:
 | 
						|
 | 
						|
... <%include include_username.html%> ...
 | 
						|
 | 
						|
This will take care of special classes for buddies, administrators, disabled
 | 
						|
users, groups, moderators, etc., as well as
 | 
						|
 | 
						|
In many cases it is necessary to display something other than user_username --
 | 
						|
for example, for posts and messages -- in which case you can set the
 | 
						|
include_username_display variable to the username to display (it will be
 | 
						|
cleared after being used).  This also handles the case where
 | 
						|
include_username_display is set, but user_id isn't set, as an indication of a
 | 
						|
deleted user, in which case you get a <span class="username deleted-user">...
 | 
						|
 | 
						|
Also note that this include will produce *no* whitespace around the <span> or
 | 
						|
<a> tag returned, so whatever whitespace padding you put or don't put around
 | 
						|
the include will be the only whitespace present.
 | 
						|
 | 
						|
Some notable exceptions to the ability to use this include exist where only a
 | 
						|
username is stored -- the last poster data for forums and threads is a good
 | 
						|
example of this.
 | 
						|
 | 
						|
--~%>
 | 
						|
<%~if not user_id and include_username_display~%>
 | 
						|
  <span class="username deleted-user" title="Deleted user"><%include_username_display%><%set include_username_display = ''%></span>
 | 
						|
<%~else%>
 | 
						|
 | 
						|
  <%~set escaped_username = escape_url unescape_html $user_username%>
 | 
						|
  <a href="<%GForum::SEO::url(params => "username=$escaped_username")%>" title="
 | 
						|
  <%~if current.user_status == $ADMINISTRATOR and not user_enabled%>User Disabled — <%endif%>
 | 
						|
  <%~if user_status == $ADMINISTRATOR%>Administrator — <%elsif forum_id and moderator.$user_id%>Moderator — <%endif%>
 | 
						|
  <%~if not user_status%>Guest — <%elsif current.user_id and current.buddy.$user_id%>Buddy — <%endif~%>
 | 
						|
  View <%user_username%>'s profile" class="username
 | 
						|
  <%~loop groups%> gr-<%loop_value.group_id%><%endloop%>
 | 
						|
  <%~if current.user_id and current.user_id == $user_id%> self<%endif%>
 | 
						|
  <%~if current.user_id and current.buddy.$user_username%> buddy<%endif%>
 | 
						|
  <%~if forum_id and moderator.$user_id%> moderator<%endif%>
 | 
						|
  <%~if user_status == $ADMINISTRATOR%> administrator<%endif%>
 | 
						|
  <%~if user_status == $ANONYMOUS%> anonymous<%endif%>
 | 
						|
  <%~if current.user_status == $ADMINISTRATOR and not user_enabled%> disabled<%endif~%>
 | 
						|
  ">
 | 
						|
  <%~if include_username_display%><%include_username_display%><%set include_username_display = ''%>
 | 
						|
  <%~else%><%user_username%>
 | 
						|
  <%~endif~%>
 | 
						|
  </a>
 | 
						|
<%~endif~%>
 |