• Resolved sankova

    (@sankova)


    Hi,
    I created a role with administrator rights in UM. The user with this role must be able to approve, edit, delete the users in WP admin
    The problem is that when click on Info in Users the Review Registration Details Form is empty.
    Please for a solution.

    • This topic was modified 3 years ago by sankova.

    The page I need help with: [log in to see the link]

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

    (@champsupertramp)

    Hi @sankova

    Are you able to change this code from current_user_can("administrator") to current_user_can("manage_options") in /wp-content/ultimate-member/includes/admin/core/class-admin-builder.php` in line 1095?

    https://github.com/ultimatemember/ultimatemember/blob/master/includes/admin/core/class-admin-builder.php#L1095

    Let’s see if this permission is causing the issue on your site.

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp

    I changed the code but the problem exist. The Form is empty.

    • This reply was modified 3 years ago by sankova.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Does it work with your first administrator account?

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,

    When I logged as an wp-administrator, the information in Review Registration Details Form is correct.
    I create a User role in UM with the following: Administrative Permission and WP Capabilities (edit_users, read, list_users, remove_users, promote_users). In the WP-Administrator the user with this role show only the user list and only the “Info” isn’t correct. When in WP Capabilities I check and “manage_options”, the view Registration Details Form is correct, but in WP-Administrator the user has access to other WP-menus, no only to user list.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Please try adding this code snippet to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code:

    add_action("init", "um_111121_init_user_has_cap");
    function um_111121_init_user_has_cap(){
        add_filter( 'user_has_cap', 'um_111121_catch_cap', 10, 3 );
    }
    
    function um_111121_catch_cap( $allcaps, $caps, $args ){
        um_fetch_user( get_current_user_id() );
        if( um_user("role") == "um_account-manager" && defined("DOING_AJAX") && isset( $_REQUEST['act_id'] ) && "um_admin_review_registration" == $_REQUEST['act_id'] ){
            $allcaps['manage_options'] = true;
        }
        return $allcaps;
    }

    The above code will allow the custom role um_account-manager to view the User Info. You need to replace the um_account-manager role slug with the user role that you need to access the User info.

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,
    I put the code in functions.php, but the site is down. The error is: 503 SERVICE UNAVAILABLE
    Unable to connect to PHP-FPM backend or maximum number of processes reached.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Could you please try this one:

    add_action("init", "um_111121_init_user_has_cap");
    function um_111121_init_user_has_cap(){
        if( defined("DOING_AJAX") && isset( $_REQUEST['act_id'] ) && "um_admin_review_registration" == $_REQUEST['act_id'] ){
            add_filter( 'user_has_cap', 'um_111121_catch_cap', 10, 3 );
        }
    }
    
    function um_111121_catch_cap( $allcaps, $caps, $args ){
        um_fetch_user( get_current_user_id() );
        if( um_user("role") == "um_account-manager" ){
            $allcaps['manage_options'] = true;
        }
        return $allcaps;
    }

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,

    Now dont have Error, but when I puch “Info” the Review Registration Details Windows opened and show the load icon only, no fetch data.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Did you change this part?
    if( um_user("role") == "um_account-manager" ){

    You need to change the “um_account-manager” with the slug of the User Role that needs to have access to the Info.

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,

    Yes, I replaced, the problem persists.

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,
    with this code and the role with ckecked “manage_options”, don’t show a data in Info.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    I couldn’t reproduce the issues on my end – it works fine with the custom code. Could you please provide a screenshot of the User Role settings of the role that has the issue? You can upload the screenshot via imgur.com and then share the image URL here so we can review it.

    Regards,

    Thread Starter sankova

    (@sankova)

    Champ Camba (@champsupertramp),

    Hier is the link:

    UM?

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    What’s the role slug for the Arthub Admin? Is it um_arthub-admin? If so, try the following code snippet:

    add_action("init", "um_111121_init_user_has_cap");
    function um_111121_init_user_has_cap(){
        if( defined("DOING_AJAX") && isset( $_REQUEST['act_id'] ) && "um_admin_review_registration" == $_REQUEST['act_id'] ){
            add_filter( 'user_has_cap', 'um_111121_catch_cap', 10, 3 );
        }
    }
    
    function um_111121_catch_cap( $allcaps, $caps, $args ){
        um_fetch_user( get_current_user_id() );
        if( um_user("role") == "um_arthub-admin" ){
            $allcaps['manage_options'] = true;
        }
        return $allcaps;
    }

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,
    Yes, that is the role.
    I tray the new code without success.

    Regards,

    • This reply was modified 3 years ago by sankova.
Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘New Role for UM’ is closed to new replies.