Visitor Documentation

Member profile update — Zoo Visitor documentation

Member profile update


<h2>Account - Profile</h2>

{if logged_in AND segment_3 == "success"}

        <h3>Profile updated</h3>

{if:elseif logged_in}

        <h3>Edit profile</h3>

        {exp:visitor:update_form return="visitor_example/profile/success"}
        <fieldset>
                <p>
                        <label for="member_firstname">{label:member_firstname}</label>
                        <input type="text" name="member_firstname" id="member_firstname" value="{if member_firstname}{member_firstname}{/if}"/>
                </p>

                <p>
                        <label for="member_lastname">{label:member_lastname}</label>
                        <input type="text" name="member_lastname" id="member_lastname" value="{if member_lastname}{member_lastname}{/if}"/>
                </p>

                <p>
                        <label for="member_birthday">{label:member_birthday}</label>
                        <input type="text" name="member_birthday" id="member_birthday" value="{member_birthday}" maxlength="23" size="25"/>
                </p>

                <p>
                        <label for="member_gender">{label:member_gender}</label>
                        {options:member_gender}
                        <input type="radio" id="member_gender" name="member_gender" value="{option_value}"{checked} />{option_value}
                        {/options:member_gender}
                </p>

        </fieldset>
        <br/>
        <fieldset>
                <legend>Native member field</legend>
                <p>Native member fields like location, url, signature, etc... can be handled by creating a channel field with the same name prefixed with "_member"
                        For example member_signature will sync to the signature field. Custom member fields can be handled in the same way. Just create a channel field prefixed with "member_" and the value
                        will also be saved to the profile.</p>

                <p>
                        <label for="member_signature">Native member signature</label>
                        <input type="text" name="member_signature" id="member_signature" value="{if member_signature}{member_signature}{/if}"/>
                </p>

        </fieldset>

        <p>
                <input type="hidden" name="title" value="{username}">
                <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}

Update Profile

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}

Support

Having problems setting up and/or using Visitor? 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.