User Documentation

User:Edit template tag

The User:Edit function allows you to create front end member profile editing forms. You can create multiple Edit forms to break down profile fields for editing (ex: profile info on one page, password change on another page, etc) or throw it all into one template. You can further specify several other parameters to filter down to who or which groups can edit which part(s) of their profile or others' profiles.

The User:Edit function will detect the currently logged in user if no member ID or username is specified in the URL. If a member ID or username is in the URL, it will pull up the information for that member. You can disable this by adding the dynamic="no" parameter.

{exp:user:edit} content {/exp:user:edit}

Parameters

The following parameters are available for use:

allowed_groups=

allowed_groups="5|8"

This parameter gives you flexibility and security against which member groups a user can assign themselves to, should you give them that option. Super Admin member group is not allowed. Works in conjunction with select_member_groups variable pair.

assign_roles=

assign_roles="role_name_1|role_name_2"

If using the User Roles feature, you can assign users to roles when they edit their profile. More likely that you would use a separate Edit form with just this parameter supplied, and a submit button. Use the short name of the role(s) you wish for the user to be assigned to upon submit of form. Use either this feature or the User Assigned Roles feature (where users can assign themselves to roles).

dynamic=

dynamic="no"

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

error_page=

error_page="user/error_template"

This parameter allows you to bypass the EE message template for displaying errors, and instead show your own regular template with the error messages. Error template must follow guidelines of User Error Page.

exclude_username=

exclude_username="member|pants"

This parameter allows you to prevent some words from being used as usernames.

form:attribute=

form:class="your_class"

This parameter allows you to control any form attribute for the form in your template. Simply replace attribute with an attribute name such as id, name, class, etc, and specify a value for that attribute. You can specify this parameter multiple times to control as many attributes as necessary. This would normally be done to control your form with Javascript or style it with CSS.

group_id=

group_id="6|7|12"

This parameter allows you to specify which additional member groups you wish to have Administrative privileges to for editing other users' profiles. This setting also respects the EE member group privileges, so be sure the member group has sufficient privileges. This setting will not allow members to change the member group assignment. To allow that, see the allowed_groups parameter.

member_id=

member_id="5"

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

onsubmit=

onsubmit="some_javascript()"

This parameter allows you to execute Javascript functions at form submission.

override_return=

override_return="template_group/template"

This parameter allows you to bypass the default EE message template page and brings the user directly to the template URI specified.

password_required=

password_required="yes"

When provided a value of yes, this parameter will force the user to enter their current password to submit any changes to their profile. Specifying a value of no with NOT disable normal password required behaviour as mentioned here.

required=

required="location|CUSTOM_MEMBER_FIELD"

This parameter allows you to force your users to enter a value for the specified fields.

return=

return="template_group/template"

This parameter allows you to return the user to a specified template upon successful submittal of form.

screen_name_password_required=

screen_name_password_required="no"

By default, users are required to enter their current password to change their screen name. By specifying this parameter with a value of no, you can disable the password check.

secure_action=

secure_action="yes"

This parameter allows you to set the action on the form to have https://. Use for processing forms with SSL.

secure_return=

secure_return="yes"

This parameter allows you to set the return on the form to have https://. Use for processing forms with SSL.

username=

username="monkey_doodle"

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

username_override=

username_override="yes"

If using the Email as Username feature, this parameter lets you indicate when an email address is to be used as a username.

user_assigned_roles=

user_assigned_roles="yes"

If using the User Roles feature, you can set up your User:Edit form to allow your users to assign roles to themselves. To allow this feature, specify a value of yes for this parameter, and be sure to specify which roles users are allowed to assign themselves to with the user_assigned_roles_allowed parameter. Used in conjunction with the roles form field.

user_assigned_roles_allowed=

user_assigned_roles_allowed="monkeys|pants_wearers|honey_dippers"

If using the User Roles feature, you can set up your User:Edit form to allow your users to assign roles to themselves. To allow this feature, specify a value of yes for the user_assigned_roles parameter, and specify which roles users are allowed to assign themselves to in this parameter. Used in conjunction with the roles form field.

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 user's avatar if they have one (ex: uploads/avatar_1.jpg).

avatar_height

{avatar_height}

This variable outputs the height of the user's avatar (ex: 60).

avatar_url

{avatar_url}

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

avatar_width

{avatar_width}

This variable outputs the width of the user's avatar (ex: 80).

email

{email}

This variable outputs the user's email address.

group_id

{group_id}

This variable outputs the user's member group ID they belong to.

join_date

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

This variable outputs the user's join date.

last_activity

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

This variable outputs the last time the user was active.

last_bulletin_date

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

This variable outputs the last time the user posted a bulletin.

last_comment_date

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

This variable outputs the last time the user submitted a comment.

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.

last_entry_date

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

This variable outputs the last time the user submitted a channel entry.

last_forum_post_date

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

This variable outputs the last time the user posted in the forums.

last_rating_date

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

This variable outputs the last time the user submitted a rating (with Rating add-on).

last_view_bulletins

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

This variable outputs the last time the user viewed a bulletin.

last_visit

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

This variable outputs the last time the user visited your website.

user_member_id

{user_member_id}

This variable outputs the users member ID.

screen_name

{screen_name}

This variable outputs the users screen name.

signature

{signature}

This variable outputs the text value of the users signature.

username

{username}

This variable outputs the user's username.

MEMBER_FIELD

{MEMBER_FIELD}

All member fields are available. To parse data for a variable, simply specify its short_name you gave it in the EE control panel.

lang:MEMBER_FIELD:label

{lang:MEMBER_FIELD:label}

This variable allows you to display the label given in the EE control panel of a given field. To construct this variable, simply use: {lang: + MEMBER_FIELD_SHORT_NAME + :label} (ex: {lang: + favorite_food + :label} = {lang:favorite_food:label}).

lang:MEMBER_FIELD:description

{lang:MEMBER_FIELD:description}

This variable allows you to display the description/instructions given in the EE CP of a given field. To construct this variable, simply use: {lang: + MEMBER_FIELD_SHORT_NAME + :description} (ex: {lang: + favorite_food + :description} = {lang:favorite_food:description}).

user:timezone_menu

{user:timezone_menu
    id="timezone_select_wrapper"
    timezone:id="timezone_id"
    country:id="country_id"
}

This timezone menu helps with date/time settings and displays two select fields. One for country, and a second for the actual timezone.

This variable accepts 3 different parameters:

  • id="my_wrapper_id" - only affects the outer wrapper of the select fields.
  • timezone:class="my_class" - only affects the timezone select field.
  • country:class="my_class" - only affects the country select field.

The country select field cannot have its onchange parameter changed, and the timezone select field cannot have its name changed. These are important to the functionality of the dropdowns.

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.

languages

<select name="language">
{languages}
    <option value="{language_name}" {selected}>{language_label}</option>
{/languages}
</select>

This variable pair helps you build a pulldown menu or set of radio buttons to allow users to set their language. Make sure that the field has a name of language. Use the language_name variable to pass the name of the time zone to the database.

select_member_groups

<select name="group_id">
{select_member_groups}
    <option value="{group_id}" {selected}>{group_title}</option>
{/select_member_groups}
</select>

This variable pair enables you to provide an option for your users to select a member group to assign themselves to. This has added security measures, and only gives users the options provided in the allowed_groups parameter.

select_MEMBER_FIELD

<select name="MEMBER_FIELD">
{select_MEMBER_FIELD}
    <option value="{value}" {selected}>{value}</option>
{/select_MEMBER_FIELD}
</select>

This variable pair is a flexible method for creating pull-down menus, radio buttons, etc. In the variable pair, you precede the short_name of the member field with select_. Providing your member field is a Select field with multiple values, it will automatically generate those values for you. Within this variable pair, the following variables become available:

  • value - the values stored as options for the member field.
  • selected - parses to selected="selected" if the option is the current value for the user's profile.
  • option_index - behaves like a count variable and displays the display order of each value.

time_format

<select name="time_format">
{select_time_format}
    <option value="{value}" {selected}>{value}</option>
{/select_time_format}
</select>

This variable pair helps you build a pulldown menu or set of radio buttons to allow users to set their time format. Make sure that you name the field time_format. Use the time_format_name variable to pass the name of the time zone to the database.

Conditionals

In addition to most of the variables above being available for use as conditionals, the following conditional is available for use:

user_no_results

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

This conditional displays its contents when there are no results found.

Form Fields

The following form fields are available for use:

accept_admin_email

<input type="checkbox" name="accept_admin_email" value="y"
{if accept_admin_email == "y"}
    checked="checked"
{/if}
/>

This form field controls whether site administrators can send the user email.

accept_user_email

<input type="checkbox" name="accept_user_email" value="y"
{if accept_user_email == "y"}
    checked="checked"
{/if}
/>

This form field controls whether other users can send the user email.

avatar_filename

<input type="file" name="avatar_filename" />

This form field allows your users to upload an avatar for their profile. To remove an existing avatar, see example here.

current_password

<input type="password" name="current_password" />

This form field is available and required in certain instances where the current password is required to update or change certain profile data:

  • password & password_confirm fields are modified (unless the submitter is a Super Admin or in one of the authorized member groups specified in the group_id parameter).
  • email field is modified.
  • username field is modified.
  • screen_name field is modified, unless screen_name_password_required parameter is specified with value of no.
  • password_required parameter is specified with value of yes.

email

<input type="text" name="email" value="{email}" />

This form field allows your users to edit their email address. Updating this field will require the user to enter their current password. Be sure to specify the current_password field for this.

group_id

<input type="text" name="group_id" value="{group_id}" />

This form field is available to Super Admins to change the member group ID of a user.

language

<select name="language">
{languages}
    <option value="{language_name}" {selected}>{language_label}</option>
{/languages}
</select>

This field is available for your users to set their language preference. To help with this, use the languages variable pair to build a pulldown menu or set of radio buttons to allow users to set their language.

notify_by_default

<input type="checkbox" name="notify_by_default" value="y"
{if notify_by_default == "y"}
    checked="checked"
{/if}
/>

This form field controls whether email notifications are enabled by default when the user posts messages.

notify_of_pm

<input type="checkbox" name="notify_of_pm" value="y"
{if notify_of_pm == "y"}
    checked="checked"
{/if}
/>

This form field controls whether email notifications are enabled when someone sends the user a private message.

password

<input type="password" name="password" />

This form field is available for your users to change their password. This field also requires the password_confirm field and the current_password field to validate the users current password. The user will be logged out on submittion of form. Super Admins are exempt from entering current password, and will not be logged out if they change their own, or others.

password_confirm

<input type="password" name="password_confirm" />

This form field is required for the user if they change their password with the password field.

roles

<label>
    <input type="checkbox" name="roles[]" value="monkeys" />
    Monkeys
</label>
<label>
    <input type="checkbox" name="roles[]" value="pants_wearers" />
    Pants Wearers
</label>
<label>
    <input type="checkbox" name="roles[]" value="honey_dippers" />
    Honey Dippers
</label>

If using the User Roles feature, use this field to generate a select menu, radios, checkboxes, etc to allow your users to assign themselves to roles. Specify the role short name or unique ID. Used in conjunction with the user_assigned_roles and user_assigned_roles_allowed parameters.

screen_name

<input type="text" name="screen_name" value="{screen_name}" />

This form field allows your users to edit their screen name. If no screen name is provided, the username will become the screen name. Updating this field will require the user to enter their current password, unless the screen_name_password_required parameter is specified with value of no. Be sure to specify the current_password field for this.

smart_notifications

<input type="checkbox" name="smart_notifications" value="y"
{if smart_notifications == "y"}
    checked="checked"
{/if}
/>

This form field controls whether smart notifications are turned on for a given user.

signature

<textarea name="signature" cols="50" rows="3">{signature}</textarea>

This form field allows your users to input text for their signature.

username

<input type="text" name="username" value="{username}" />

This form field allows your users to edit their username. Updating this field will require the user to enter their current password. Be sure to specify the current_password field for this.

MEMBER_FIELD_SHORT_NAME

<input type="text" name="MEMBER_FIELD_SHORT_NAME" value="{MEMBER_FIELD_SHORT_NAME}" />

<input type="checkbox" name="MEMBER_FIELD_SHORT_NAME" value="y"
{if MEMBER_FIELD_SHORT_NAME == "y"}
    checked="checked"
{/if}
/>

All member fields as noted in Variables section are available for edit. Construct them like example above.

Examples

The following is a basic example of how your Edit form might look:

{exp:user:edit
    return="user/edit"
}
    <p>
        <label for="location">Location</label>
        <input name="location" id="location" value="{location}" />
    </p>
    <p>
        <label>
            <input type="checkbox" name="accept_user_email" value="y" {if accept_user_email == "y"}checked="checked"{/if} />
            Accept User Email?
        </label>
    </p>
    <p>
        <label for="YOUR_MEMBER_FIELD">YOUR MEMBER FIELD</label>
        <input name="YOUR_MEMBER_FIELD" id="YOUR_MEMBER_FIELD" value="{YOUR_MEMBER_FIELD}" />
    </p>
    <p>
        <label for="email">Email</label>
        <input name="email" id="email" value="{email}" />
    </p>
    <p>
        <label for="username">Username</label>
        <input name="username" id="username" value="{username}" />
    </p>
    <p>
        <label for="screen_name">Screen Name</label>
        <input name="screen_name" id="screen_name" value="{screen_name}" />
    </p>
    <p>
        <label for="password">Create a New Password?</label>
        <input type="password" name="password" id="password" />
    </p>
    <p>
        <label for="current_password">Current Password</label>
        <input type="password" name="current_password" id="current_password" />
    </p>
    <p>
        <label for="password_confirm">Confirm Current Password</label>
        <input type="password" name="password_confirm" id="password_confirm" />
    </p>
    <p>
        <button type="submit">Update</button>
    </p>
{/exp:user:edit}

Add or Remove Avatars

To add or remove avatar images, use the following code example. It’s recommended that the avatar image upload/removal form has its own page like the native EE Member area, as removing creates a page submit and could lose the users other profile changes:

Edit/Remove Avatar:

{exp:user:edit
    return="user/edit_avatar"
}
    <p>
        Current Avatar:
        <img src="{avatar_url}{avatar_filename}" width="{avatar_width}" height="{avatar_height}" />
        <input type="submit" name="remove_avatar" value="Remove Current Avatar?" />
    </p>
    <p>
        <label>Upload a New Avatar:</label>
        <input type="file" name="avatar_filename" />
        <input type="submit" value="Submit" />
    </p>
{/exp:user:edit}

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.