Zoo Visitor

User guide

Profile update

The update form tag can be used to update native member fields like password, username, screen_name, email & all custom fields you have defined in the member channel.

{exp:visitor:update_form}

Update tag parameters

return

This parameter allows you to define where the user is returned to when finishing the update return=”account/update_profile/success”

error_handling

Default off, set to “inline” to enable inline error handling.

error_delimiters

Error delimiters of errors when selecting inline error_handling. Each error will be wrapped in this piped parameter error_delimiters=’<span class=”error”>|</span>’

id

css id of the form

class

css class of the form

require_password

(Optional) Default off, set to “yes” to require the current password. This parameters allows you to require the input of the current password when updating other profile fields like firstname, lastname, birthday etc... When updating username, screen_name, email or password inside the update form providing the current password is always required except for super-admins and the parameter does not have to be specified.

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

When using error_handling=”inline”, {error:current_password} can be used to display the current password error.

include_jquery

Included by default, set include_jquery =”no” to use your own copy of jQuery

preserve_checkboxes

Included by default

safecracker_head (EE versions prior to 2.7.0)

Included by default. Adds necessary Javascript to your form. If you don’t require Javascript functionality, set to “no”. In versions higher or equal to 2.7.0. use the include_assets paramter instead http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/#include-assets

Optional safecracker parameters (EE versions prior to 2.7.0)

The following SafeCracker parameters can be used in the registration form tag:

dynamic_title=”[member_firstname] registration” json=”yes” datepicker=”yes” rules:my_field_name=”required|min_length[5]” secure_action secure_return return_X

See the SafeCracker documentation for more details about these parameters

Channel Form parameters (EE versions >= 2.7.0)

See the channel form documentation for available tags http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/#parameters

member_id

(Optional) The member_id of the member you want to edit in the update form

member_entry_id

(Optional) The member channel entry id of the member you want to edit in the update form

username

(Optional) The username of the member you want to edit in the update form When member_id, member_entry_id or username is not provided as a parameter, the current logged in member details will be used in the update form.

allowed_groups

When updating the membergroup, you have to provide the group ids of the allowed member groups as a pipe. allowed_groups=”5|6” Use a field with name “group_id” to select the member group in the update form.

Update tag variables

The following native member error fields are available when the parameter error_handling=”inline”:

{error:username} {error:screen_name} {error:email} {error:current_password} {error:password} {error:captcha} {error:accept_terms}

Use the following tag for error reporting of other custom channel member fields

{error:your_custom_fieldname}

Display all field errors

{field_errors}{error}{/field_errors}

Update tag examples

Basic example

    {exp:visitor:update_form return='account/update_profile/success'}

        Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />

        Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />

        Gender (radiobuttons): {options:member_gender} <input id="member_gender" name="member_gender" type="radio" value="{option_value}" />{option_value} {/options:member_gender}

        Birthday (datepicker): <input id="member_birthday" maxlength="23" name="member_birthday" size="25" type="text" value="" />

        <input class="form-submit" type="submit" value="Update profile" />

{/exp:visitor:update_form}

Changing membergroup during profile update

When allowing to choose the membergroup upon registration, make sure to use the allowed_groups parameter and a field with name “group_id”

    {exp:visitor:update_form error_handling="inline" return='account/register/success' allowed_groups="5|6"}

                Select member group:
                <select name="group_id">
                        <option value="5">Group with id 5</option>
                        <option value="6">Group with id 6</option>
                </select>

                Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
                {error:member_firstname}

                Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
                {error:member_lastname}

                <input class="form-submit" type="submit" value="Update" />

{/exp:visitor:update_form}

Working with native member fields

Native custom member fields can be used when integrating with MailChimp/Campaign Monitor subscriptions which are handled by other extensions and depend on native fields.

Native fields like signature, url, locations etc... and custom created member fields can be managed by creating a channel field with the same name prefixed with “member_”. Changes in these channel fields will be reflected in the native fields.

    {exp:visitor:update_form error_handling="inline" return='account/register/success'}

                Member signature: <input name="member_signature" type="text" value="" />
                {error:member_signature}

                Member location: <input name="member_location" type="text" value="" />
                {error:member_location}

                <input class="form-submit" type="submit" value="Update" />

{/exp:visitor:update_form}

Changing your username

    {if logged_in AND segment_3 == "success"}
            <h3>Login updated</h3>
{if:elseif logged_in}
    {exp:visitor:update_form return="visitor_example/change_login/success"}

            <fieldset>
            <p>
                    <label for="EE_email" class="form-label">Your login email:</label>
                    <input type="text" name="username" id="username" class="form-text" value="{username}" />
            </p>
            <p>
                    <label for="current_password" class="form-label">In order to change your password, please provide your current password:</label>
                    <input type="text" name="current_password" id="current_password" class="form-text"  />
            </p>

            </fieldset>
            <p>
             <input type="submit" value="Submit" class="button" />
             </p>
             </fieldset>

    {/exp:visitor:update_form}

{if:else}
    You are not logged in
{/if}

Changing your password

    <h2>Account - Change password</h2>
{if logged_in AND segment_3 == "success"}
            <h3>Password updated</h3>
{if:elseif logged_in}
    {exp:visitor:update_form return="visitor_example/change_password/success"}
                    <fieldset>
                            When changing your password, you will be asked to login again for security reasons.
                            <p>
                                    <label for="current_password" class="form-label">Current password:</label>
                                    <input type="text" name="current_password" id="current_password" class="form-text"  />
                            </p>
                            <p>
                    <label for="new_password" class="form-label">New password</label>
                    <input type="password" name="new_password" id="new_password" class="form-text"  />
                </p>
                <p>
                    <label for="new_password_confirm" class="form-label">Confirm New password</label>
                                    <input type="password" name="new_password_confirm" id="new_password_confirm" class="form-text"  />
                            </p>

                    </fieldset>
                <p>
                    <input type="submit" value="Submit" class="button" />
                </p>

    {/exp:visitor:update_form}
{if:else}
    You are not logged in. <a href="{path=visitor_example/login}">Login</a> now.
{/if}