Navigation

 ·   Wiki Home
 ·   Wiki Help
 ·   Categories
 ·   Title List
 ·   Uncategorized Pages
 ·   Random Page
 ·   Recent Changes
 ·   RSS
 ·   Atom
 ·   What Links Here

Active Members:

Search:

 

Create or Find Page:

 

View Display Followers

The Display Followers tag is used to display members and their relationships to other members. It can be used to display lists of all members, or information for a specific member either specified by a parameter or the currenly logged in user. These lists can be sorted in various orders, and limited to specific member groups.

An example usage is:

{exp:ajw_followers:display show="all" orderby="join_date" sort="desc" limit="5" group_id="5"}
<ul class="follow">
{members}
<li>{screen_name} {button}</li>
{/members}
</ul>
{/exp:ajw_followers:display} 

This lists the 5 newest member to join the site, along with a button that allows a logged in user to add them to their list of members they are following.

Parameters

member_id=

Some of the options available via the show parameter allow a member id to be specified. If it is not specified, the currently logged in member visiting the site is assumed.

show=

There are 4 options for the show parameter.

show="all" 

This displays all members whether or not they they are friends of the current user or member selected by the member_id parameter. The member_id is not required for this option.

show="member" 

This displays the relationship of the current user with the member selected by the member_id parameter. The member_id is required.

show="followers" 

This display the members following the selected user. If the member_id parameter is not specified it will use the current user.

show="following" 

This display the members followed by the selected user. If the member_id parameter is not specified it will use the current user.

group_id=

group_id=

This limits results to a member group

orderby=

orderby=screen_name 

Orders the results by a member field

sort=

sort=asc 
sort=desc 

Selects the sort order

limit=

limit=10 

Limits the number of members to display

template=

template=follower/email_template 

This parameter allows you to select a template to use to format a email to be sent to the member when another member chooses to follow them.

return=

return="{path=follow/thank-you}" 

Specifies a page to redirect the user to when they have followed or un-followed another member.

form_id=, form_name=

Gives the follow/unfollow form generated by the {button} variable an id/name

 

Conditionals

{if no_members}

{if no_members}<p>No members</p>{/if} 

This can be used to display a message if the tag finds no members matching the parameters.

 

Variable pairs

{members}

{members}
{screen_name} {button}
{members} 

{members} is a “looping pair” where the contents are replaced for each member returned by the tag.


Within the {member}{/member} variables the following are allowed:

Backspace parameter

backspace=

Variables

All member profile and custom member fields are available, eg, {id}, {screen_name}, {email}

Button variable

{button} 

The {button} variable provides a form to allow the currenlty logged in user to follow/unfollow this member.

The Form/Form Button variable pair

{form}
{form_button}
{
/form} 

The {button} variable creates a form with a single button. There is an alternative to the {button} syntax that provides a little more flexibility to the display of this form.

By using the {form}{form_button}{/form} syntax you can specify where you want the form to start and end, allowing the form to be wrapped around other content.

Note the {form}{/form} must still appear within the {members}{/members} variable pair.

Conditionals

{if following}
<p>Already following this user...</p>
{/if} 

Tests if the currently logged in users is following this member

Examples

Recently joined members

This lists members by join date with a link to a ‘Confirm follow/unfollow’ page

{exp:ajw_followers:display show="all" orderby="join_date" sort="desc" group_id="5"}
{if no_members}
<p>No new members</p>{/if}
<ul class="follow">
{members}
<li><a href="{path=membership/profile}{member_id}">{screen_name}</a>
{if logged_in}
-
{if following}
<a href="{path=membership/follow_confirm/{member_id}}">Remove</a>
{if:else}
<a href="{path=membership/follow_confirm/{member_id}}">Add</a>
{/if}
{
/if} 
</li>
{/members}
</ul>
{/exp:ajw_followers:display} 

Currently logged in user’s follows

Lists the members that current user is following with an ‘unfollow’ button

{if logged_in}
<h2>You are following</h2>
{exp:ajw_followers:display show="following" orderby="screen_name" sort="asc"}
{if no_members}
<p>No one yet!</p>{/if}
<ul class="follow">
{members}
<li><a href="{path=membership/profile}{member_id}">{screen_name}</a{button}</li>
{/members}
</ul>
{/exp:ajw_followers:display}
{
/if} 

Followers

List who is followig this member (selected using a url segment). Uses the backspace parameter to remove the comma on the last member name.

<p><strong>Followers:</strong>
{exp:ajw_followers:display show="followers" member_id="{segment_3}" orderby="screen_name" sort="asc"}
{if no_members}No one{
/if}
{members backspace
="3"}
<a href="{path=membership/profile}{member_id}">{screen_name}</a>, 
{/members}
{
/exp:ajw_followers:display}
</p

An example confirmation page

Include a template parameter to send an email to the member being followed. The email contents are taken from the membership/follow_email template. If no template parameter is specified, then no email is sent.

{if logged_in}
<h3>Confirm</h3>
{exp:ajw_followers:display show="member" member_id="{segment_3}" template="membership/follow_email"}
{members}
{if following}
<p>You are following this member. Do you want to stop following?</p>
{if:else}
<p>Do you want to follow this member?</p>
{/if}
{button}
{
/members}
{
/exp:ajw_followers:display}
{
/if}