User Documentation

User:Profile template tag

The User:Profile tag lets you show profile information for a given member. It is most commonly used for displaying a member profile. By default, it will show the information for the currently logged in user. If a member ID or username is present in the URL, it will display information for that user.

{exp:user:profile} content {/exp:user:profile}

Parameters

The following parameters are available for use:

dynamic=

dynamic="no"

This parameter is available to stop the loop from looking into the URI for an ID of any type.

log_views=

log_views="off"

This parameter allows you to disable incrementing of profile views each time the User:Profile tag is run. This might be helpful in a scenario where you use the User:Profile tag twice on a template, etc, so it does not log 2 views each time the page is loaded. See profile_views variable.

member_id=

member_id="5"

This parameter allows you to show the specified member's profile. A variable like {segment_3} can also be used to pull a Member ID from the URL.

username=

username="some_username"

This parameter allows you to show the specified member's profile. A variable like {segment_3} can also be used to pull a username from the URL.

Variables

All member fields are available for use, including several extra variables:

avatar_filename

{avatar_filename}

This variable outputs the upload directory path, filename, and file extension of the users avatar if they have one (ex: uploads/avatar_1.jpg).

avatar_height

{avatar_height}

This variable outputs the height of the users avatar (ex: 60).

avatar_url

{avatar_url}

This variable outputs the avatar directory path (ex: http://yoursite.com/images/avatars/).

avatar_width

{avatar_width}

This variable outputs the width of the users avatar (ex: 80).

daylight_savings

{daylight_savings}

This variable outputs a y or n value of whether or not the user is observing daylight savings time. Typically used as a conditional.

email

{email}

This variable outputs the users email address.

group_id

{group_id}

This variable outputs the member group ID the user belongs to.

group_title

{group_title}

This variable outputs the group name the user belongs to.

ip_address

{ip_address}

This variable outputs the IP address the user last accessed the website with.

join_date

{join_date format="%F %j, %Y"}

This variable outputs the user's join date. Uses standard EE date formatting.

last_activity

{last_activity format="%F %j, %Y"}

This variable outputs the last time the user was active. Uses standard EE date formatting.

last_bulletin_date

{last_bulletin_date format="%F %j, %Y"}

This variable outputs the last time the user posted a bulletin. Uses standard EE date formatting.

last_comment_date

{last_comment_date format="%F %j, %Y"}

This variable outputs the last time the user posted a comment. Uses standard EE date formatting.

last_email_date

{last_email_date format="%F %j, %Y"}

This variable outputs the last time the user sent an email via the EE email function. Uses standard EE date formatting.

last_entry_date

{last_entry_date format="%F %j, %Y"}

This variable outputs the last time the user published a channel entry. Uses standard EE date formatting.

last_forum_post_date

{last_forum_post_date format="%F %j, %Y"}

This variable outputs the last time the user posted in the forums (if installed). Uses standard EE date formatting.

last_rating_date

{last_rating_date format="%F %j, %Y"}

This variable outputs the last time the user submitted a rating (with the Rating add-on). Uses standard EE date formatting.

last_view_bulletins

{last_view_bulletins format="%F %j, %Y"}

This variable outputs the last time the user viewed a bulletin. Uses standard EE date formatting.

last_visit

{last_visit format="%F %j, %Y"}

This variable outputs the last time the user visited your website. Uses standard EE date formatting.

user_member_id

{user_member_id}

This variable outputs the user's member ID.

private_messages

{private_messages}

This variable outputs the amount of privates messages the user has.

profile_views

{profile_views}

This variable shows the number of times the user's profile has been viewed. Use of the User:Profile tag triggers the counting of a profile view. When you view your own profile it doesn't count. You can disable tracking with the log_views parameter.

role_total

{role_total}

If using the User Roles feature, this variable shows the total number of all roles the user has been assigned.

member_role_total

{member_role_total}

If using the User Roles feature, this variable shows the total number of member-based roles the user has been assigned.

group_role_total

{group_role_total}

If using the User Roles feature, this variable shows the total number of member group-based roles the user has been assigned.

screen_name

{screen_name}

This variable outputs the user's screen name.

signature

{signature}

This variable outputs the text value of the user's signature.

time_format

{time_format}

This variable shows the user's time formating (ex: us, eu).

timezone

{timezone}

This variable shows the user's timezone settings.

total_combined_posts

{total_combined_posts}

This variable displays the user's total amount of combined posts (ex: forums, channel entries, comments, etc).

total_comments

{total_comments}

This variable displays the user's total amount of comments.

total_entries

{total_entries}

This variable displays the user's total amount of channel entries.

total_forum_posts

{total_forum_posts}

This variable displays the user's combined total amount of forums topics and replies.

total_forum_replies

{total_forum_replies}

This variable displays the user's total amount of forums replies.

total_forum_topics

{total_forum_topics}

This variable displays the user's total amount of forums topics.

total_ratings

{total_ratings}

This variable displays the total amount of ratings submitted by the user (with Rating add-on).

username

{username}

This variable outputs the user's username.

member_field

{MEMBER_FIELD}

All member fields are available. Use the field's short_name for variable name.

Variable Pairs

The following variable pairs are available for use:

fields

<ul>
{fields}
    <li>
    {field_label}:
    {if field_type == "date"}
        {field_value format="%F %j, %Y"}
    {if:else}
        {field_value}
    {/if}
    </li>
{/fields}
</ul>

This variable pair allows you to automatically show and parse all member field data for a given user, following whatever format you specify in between the opening and closing tag pair. The following variables/conditionals are available for use within it:

  • {field_label} - the label of the field, as defined in CP.
  • {field_value} - the value the user selected for the field. Use format parameter to style date if it's a Date field.
  • {field_type} - the fieldtype for the field. E.g. select, date, etc.

roles

<ul>
{roles}
    <li>{role_label}</li>
{/roles}
</ul>

If using the User Roles feature, you can use this variable pair to display all the roles the user is currently assigned to. The following variables are available for use inside of the variable pair:

  • role_id - displays the unique role ID.
  • role_name - displays the short name of the role.
  • role_label - displays the full name / label for the role.
  • role_description - displays the description of the role.

member_roles

<ul>
{member_roles}
    <li>{role_label}</li>
{/member_roles}
</ul>

If using the User Roles feature, you can use this variable pair to display the member-based roles the user is currently assigned to. The following variables are available for use inside of the variable pair:

  • role_id - displays the unique role ID.
  • role_name - displays the short name of the role.
  • role_label - displays the full name / label for the role.
  • role_description - displays the description of the role.

group_roles

<ul>
{group_roles}
    <li>{role_label}</li>
{/group_roles}
</ul>

If using the User Roles feature, you can use this variable pair to display the member group-based roles the user is currently assigned to. The following variables are available for use inside of the variable pair:

  • role_id - displays the unique role ID.
  • role_name - displays the short name of the role.
  • role_label - displays the full name / label for the role.
  • role_description - displays the description of the role.

Conditionals

The variables above are available as conditionals. Additionally, these exist as well:

user_no_results

{if user_no_results}
    Sorry, no results were found.
{/if}

This conditional displays its contents when there is no match for a member ID or username requested.

Examples

Below is a basic example of how your Stats template code might look:

{exp:user:profile}
    <h3>{screen_name}</h3>
    <p>Email: {email}</p>
    <p>Location: {location}</p>
    <p>Total Entries: {total_entries}</p>
    <p>Join Date: {join_date format="%F %j, %Y"}</p>
{/exp:user:profile}

The following is an example that somewhat mimics the native EE member profile view template:

{exp:user:profile}

    <div id="main">
    {if avatar_filename}
        <p><img src="{avatar_url}{avatar_filename}" width="{avatar_width}" height="{avatar_height}" alt="{screen_name}" /></p>
    {/if}
        <h2>{screen_name}</h2>
        <p>{group_title}</p>
        <p><a href="/?ACT=19&mbr={user_member_id}">View all posts by this member</a></p>
    </div>

    <div id="communications">
        <h3>Communications</h3>
        <p>URL: {url}</p>
        <p>Email Address: {encode="{email}"}</p>
        <p><a href="{path='member/messages/pm'}/{user_member_id}/">Send Private Message</a></p>
    </div>

    <div id="personal_info">
        <h3>Personal Info</h3>
        <p>Location: {location}</p>
        <p>Occupation: {occupation}</p>
        <p>Interests: {interests}</p>
        <p>Your Custom Field: {YOUR_CUSTOM_FIELD}</p>
        <p>Another Custom Field: {YOUR_CUSTOM_FIELD}</p>
    </div>

    <div id="statistics">
        <h3>Statistics</h3>
        <p>Member Group: {group_title}</p>
        <p>Total Entries: {total_entries}</p>
        <p>Total Comments: {total_comments}</p>
        <p>Member Local Time: {current_time format="%F %j, %Y %g:%i %a"}</p>
        <p>Last Visit: {last_visit format="%F %j, %Y %g:%i %a"}</p>
        <p>Join Date: {join_date format="%F %j, %Y %g:%i %a"}</p>
        <p>Most Recent Entry: {last_entry_date format="%F %j, %Y %g:%i %a"}</p>
        <p>Most Recent Comment: {last_comment_date format="%F %j, %Y %g:%i %a"}</p>
        <p>Birthday: {birthday format="%F %j, %Y %g:%i %a"}</p>
    </div>

    <div id="bio">
        <h3>Bio</h3>
        <p>{bio}</p>
    </div>

{/exp:user:profile}

Below is an example of how to show a users channel entries they've authored in their profile:

Main Template

{exp:user:profile}
    <h3>Screen Name: {screen_name}</h3>
    <p>Location: {location}</p>
    <p>Join Date: {join_date format="%F %j, %Y"}</p>
    <h4>This members entries ({total_entries}):</h4>
    {embed="user/member_entries" author_id="{user_member_id}"}
{/exp:user:profile}

Embedded Template

The embedded template ("user/member_entries") would look like this:

<ul>
{exp:channel:entries
    author_id="{embed:author_id}"
}
    <li><a href="{url_title_path='path_to/channel_entries'}/">{title}</a></li>
{/exp:channel:entries}
</ul>

Support

Having problems setting up and/or using User? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.