• Resolved pengie5696

    (@pengie5696)


    I cannot share a link to the website as it’s a private site with proprietary health information, unfortunately.

    I have a client website for physicians that combines a public site and a member-only component set with UM quite elegantly for proprietary content and communications.

    Actual Use Case. There are 3 roles – Administrator, Director (who doesn’t have access to wp-admin dashboard to keep everything they do on the frontend of the site) and then a Member role for non admins customized to allow access to a cloud drive to read/download files, etc. and communicate with one another. Directors have the ability to add new Members from the front-end of the site via either Gravity Forms or Uploading a CSV file, manage cloud content at different access levels, manage blog communications and a private event calendar. They don’t do anything from the backend of the site.

    We just had an issue where a Member email address was incorrect for one of the Members whose membership was created via bulk upload on the front end of the website. While we could have asked him to simply login with the username and password sent to change the email himself in his profile, the Director admin wanted to accommodate the member and take care of the matter directly.

    The Member List displayed the user along with the original primary email address directly under the name, but the primary email address field doesn’t display when the cog is clicked to Edit Profile. Only the optional secondary email address visible to edit.

    Roles are set to allow Directors full privileges to edit users.

    Is there a setting or something I can add — code snippet etc — as a custom capability in User Role Editor to enable the two top roles to be able to modify the primary email from Member List | Edit Profile for all authorized members? I don’t know what to call the capability. Directors don’t have back-end wp-admin access, and while I do as the admin, the organization wants more autonomy to manage their membership.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @pengie5696

    You can only change a user email via UM Account form. It requires customization if you want to change the email via UM Profile Form. You can try the following code snippet to make the Email Address field show in the Profile Form:

    add_action("um_submit_form_profile","um_012722_email_validation", 1 );
    function um_012722_email_validation( $post_form ){
       
        if( isset( $post_form['user_email'] ) && ! empty( $post_form['user_email'] ) ){
            $user = wp_get_current_user();
    
            if( email_exists( $post_form['user_email'] ) && $post_form['user_email'] !== $user->user_email ){
                UM()->form()->add_error( 'user_email', __( 'Your email address is already taken', 'ultimate-member' ) );
            }
        }
    }
    
    add_filter( 'um_user_profile_restricted_edit_fields', 'um_012722_enable_email_address_editing');
    function um_012722_enable_email_address_editing( $fields ){
    
        unset( $fields[0] );
        return $fields;
    }

    You can add the code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    Regards,

    Thread Starter pengie5696

    (@pengie5696)

    Hello Champ Camba –

    That worked perfectly!!! You’re my hero of the day.

    Thank you so very much.

    Kind regards!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @pengie5696

    Thanks for letting us know.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Authorized Admin/Role Edit Primary User email from Member List – Edit Profile’ is closed to new replies.