Editing User Profiles

    Editing user profile

    Profile controller allow authorized users to change their profiles, as well as passwords.

    E-mail should be checked for uniqueness with controller's special rule:

    &rules=`{
        "email":{
            "required":"Enter e-mail",
            "email":"Wrong e-mail",
            "custom":{
                "function":"\\FormLister\\Profile::uniqueEmail",
                "message":"You cannot use this e-mail"
            }
        }
    }`

    The same for the "username" field:

    &rules=`{
        "username":{
            "required":"Enter user name",
            "alphaNumeric":"Only letters and digits are allowed",
            "custom":{
                "function":"\\FormLister\\Profile::uniqueUsername",
                "message":"You cannot use this name"
            }
        }
    }`

    If the "password" field is empty, then the password will stay unchanged. The new password is stored in the "user.password" field. If the field specified by "verificationField" parameter is changed and "checkActivation" parameter is enabled then user needs to be authorized again.

    Parameters

    model

    Class to manage users.

    Possible values - class name. Use Pathologic\EvolutionCMS\MODxAPI\modUsers model from pathologic/modxapi package in Evo 3.0.

    Default value - \modUsers

    modelPath

    Path to the class to manage users.

    Possible values - relative file path.

    Default value - assets/lib/MODxAPI/modUsers.php

    allowedFields

    Fields allowed to process, other fields are ignored. If password is changed, then the "password" field will be added to the list. If no value is set to the "username" field then, it this field be set with the "e-mail" field value. The "username" will be allowed in this case.

    If not set, then all fields are allowed.

    Possible value - field names, comma separated.

    Default value - none.

    forbiddenFields

    Fields forbidden to process. The "password" and "username" fields are processed the same way as for the "allowedFields" parameter.

    Possible value - field names, comma separated.

    Default value - none.

    verificationField

    When this field is changed, then profile activation will be reset.

    Possible value - field name.

    Default value - email.

    checkActivation

    Logs user out when set if verification field is changed.

    Possible values - 0, 1.

    Default value - 0.

    preparePostProcess

    Allows to process data after saving user data.

    Possible values - snippet names, anonymous functions, static methods of loaded classes.

    Default value - none.

    redirectTo

    Redirects user after successful profile update.

    Possible values - target page id or array.

    Default value - none.

    exitTo

    Redirects non authorized user.

    Possible values - target page id or array.

    Default value - none.

    skipTpl

    Outputs message if user is not authorized.

    Possible values - template name, according to DocLister templating rules.

    Default value - profile lexicon entry with the key [%profile.default_skipTpl%].

    successTpl

    Success message template.

    Possible values - template name, according to DocLister templating rules.

    Default value - none.

    dateFormat

    Date format for the "dob" field.

    Possible values - date format according to the "date" function ("d.m.Y" etc.).