Friends 1.0 Form
This form allows you to list either your friends or members of the site. Your users can select which friends to add and delete from their friends lists by using this form.
Parameters
- days
- form_name
- form_id
- friend_template
- group_id
- hours
- limit
- link
- notify
- onsubmit
- orderby
- member_id
- return
- sort
- screen_name
- template
- type
- username
days =
days = "10"
The 'days' parameter allows you to limit the member list. If you're using the form in 'mine' mode, this will limit the members to those who were added to your friends list within the last number of days specified. If used in 'member' mode, the limit will be on the join date of the member.
form_name =
form_name = "this_form"
The 'form_name' parameter allows you to declare the name of the form in order to control it with Javascript.
form_id =
form_id = "this_form_id"
The 'form_id' parameter allows you to declare the id of the form in order to control it with Javascript.
friend_template =
friend_template = "template_group/template"
The 'friend_template' parameter allows you to specify what template to use to format email notifications sent when someone is added to another person's friend list.
group_id =
group_id = "6"
The 'group_id' parameter allows you to filter the list of members in the form by one or more group ids. Separate multiple groups with the pipe "|" character.
hours =
hours = "2"
The 'hours' parameter allows you to limit the member list. If you're using the form in 'mine' mode, this will limit the members to those who were added to your friends list within the last number of hours specified. If used in 'member' mode, the limit will be on the join date of the member.
limit =
limit = "10"
The 'limit' parameter allows you to limit the member list results.
link =
link = "{path='friends/invites'}"
The 'link' parameter is used inside the email notification template (see the friend_template parameter). When a user adds a friend to their list a notification is sent to that friend inviting them to add that person as a friend to their friends list. Notifications are not sent when you set the 'notify' parameter to 'no' or when the 'friend_template' parameter is not provided. On the template you specified, you can use the exp:friends:members function to show all of the invitations for a given user. Just specify 'CURRENT_USER' in the 'friend_id' parameter.
notify =
notify = "no"
The 'notify' parameter allows you to specify whether notifications should be sent to users who have been added or deleted from someone's friends list. The default is 'yes'.
member_id =
member_id = "34"
The 'member_id' parameter allows you to hard code the member id.
orderby =
orderby = "screen_name"
The 'orderby' parameter allows you to indicate by which fields to order your member list results. Separate multiple values by the pipe "|" character.
onsubmit =
onsubmit = "some_javascript()"
The 'onsubmit' parameter allows you to execute Javascript functions at form submission.
return =
return = "{path=template_group/template}"
The 'return' parameter allows you to control the landing page where users are taken once they submit your form.
screen_name =
screen_name = "some_user"
The 'screen_name' parameter allows you to filter the member list by those members who share the same first few letters of their screen name. Note that you can have 'screen_name' as a segment in a URL to indicate which letters to filter by. The next segment following the 'screen_name' segment should contain the letters.
sort =
sort = "desc"
The 'sort' parameter allows you to change the order of your member list. The default is 'asc' for ascending. Specify 'desc' for descending.
template =
template = "template_group/template"
The 'template' parameter allows you to specify what template to use among your site templates to use as the formatting template for messages from the Friends module. This is most commonly used when enabling AJAX websites.
type =
type = "mine"
The 'type' parameter allows you to designate what type of member list to retrieve. Indicating 'mine' will grab a list of your friends. Whereas indicating 'member' will grab a list of members of the site.
username =
username = "some_user"
The 'username' parameter allows you to filter the member list by those members who share the same first few letters of their username. Note that you can have 'username' as a segment in a URL to indicate which letters to filter by. The next segment following the 'username' segment should contain the letters.
Variables
In addition to all of your custom member fields, the following member fields are available.
- aol_im
- accept_messages
- avatar_url
- bday_d
- bday_m
- bday_y
- bio
- daylight_savings
- group_id
- icq
- interests
- ip_address
- join_date
- location
- language
- last_activity
- last_bulletin_date
- last_comment_date
- last_email_date
- last_entry_date
- last_forum_post_date
- last_rating_date
- last_view_bulletins
- last_visit
- member_id
- msn_im
- occupation
- photo_filename
- photo_ur
- private_messages
- profile_views
- sig_img_filename
- sig_img_url
- screen_name
- signature
- timezone
- time_format
- template_size
- total_comments
- total_entries
- total_forum_topics
- total_forum_posts
- total_ratings
- url
- username
- yahoo_im
accept_messages
{accept_messages}
aol_im
{aol_im}
avatar_url
{avatar_url}
The avatar url is the full url to the directory on your server that contains member avatars.
bday_d
{bday_d}
bday_m
{bday_m}
bday_y
{bday_y}
bio
{bio}
daylight_savings
{daylight_savings}
{email}
group_id
{group_id}
icq
{icq}
interests
{interests}
ip_address
{ip_address}
join_date
{join_date}
language
{language}
last_activity
{last_activity}
last_bulletin_date
{last_bulletin_date}
last_comment_date
{last_comment_date}
last_email_date
{last_email_date}
last_entry_date
{last_entry_date}
last_forum_post_date
{last_forum_post_date}
last_rating_date
{last_rating_date}
last_view_bulletins
{last_view_bulletins}
last_visit
{last_visit}
location
{location}
member_id
{member_id}
msn_im
{msn_im}
occupation
{occupation}
photo_filename
{photo_filename}
photo_url
{photo_url}
The photo url is the full url to the directory on your server that contains member photos.
private_messages
{private_messages}
profile_views
{profile_views}
This variable shows the number of times that a member's profile has been viewed. Use of the user:stats function triggers the counting of a profile view. When you view your own profile it doesn't count.
screen_name
{screen_name}
signature
{signature}
sig_img_filename
{sig_img_filename}
sig_img_url
{sig_img_url}
The sig img url is the full url to the directory on your server that contains member's signature images.
template_size
{template_size}
time_format
{time_format}
timezone
{timezone}
total_comments
{total_comments}
total_entries
{total_entries}
total_forum_posts
{total_forum_posts}
total_forum_topics
{total_forum_topics}
total_ratings
{total_ratings}
username
{username}
url
{url}
yahoo_im
{yahoo_im}
Variable Pairs
members
{ members}{/members}
The 'members' variable pair is used to establish the formatting of each row of the member list that will be contained inside your form.
Conditionals
You can run conditionals on any of the custom member fields and standard member fields above. These additional conditionals are also available.
friend
{if friend}{/if}
The 'if friend' conditional evaluates to true if the given member is in your list of friends.
reciprocal
{if reciprocal == 'y'}{/if}
The 'if reciprocal' conditional allows you to test whether a given member is in your list of friends and is a reciprocal friend. A reciprocal friend is one who also has a record of you in their friends list.
public
{if public == 'y'}{/if}
The 'if public' conditional allows you to test whether a given member is in your list of friends and is a public friend. A public friend is one that you have indicated as being visible to the public.
Form Fields
delete
< type="checkbox" name="delete" value="yes" />
The 'delete' field allows your users to remove the selected members from their list of friends when they submit the form.
member
< type="checkbox" name="member[]" value="{member_id}" />
The 'member' field allows you to create a list of members to either be added or deleted from a friends list. Make sure you specify the name of the field with an open and closing square brackets so that the Friends module knows that an array of members is being submitted.
Examples
{exp:friends:form type="member" friend_template="friends/friend_template"}
{members}
<input type="checkbox" name="member[]" value="{member_id}" {if friend}checked="checked"{/if} /> {member_id} | <a href="{path=’friends/add’}{member_id}">{screen_name}</a> | {email} | <a href="{path=’friends/add’}{member_id}/delete">delete</a> | {first}<br />
{/members}
<input type="checkbox" name="delete" value="yes" /> Delete?<br />
<input type="submit" />
{/exp:friends:form}