Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • tanner
    Participant

    Not sure if you can help me here, I’ve been getting a ton of PHP warnings:

    [01-Jul-2018 21:54:09 UTC] PHP Warning:  in_array() expects parameter 2 to be array, null given in .../wp-content/mu-plugins/ure-assist/ure-assist.php on line 26
    [01-Jul-2018 21:54:09 UTC] PHP Notice:  Undefined variable: user in .../wp-content/mu-plugins/ure-assist/ure-assist.php on line 26
    [01-Jul-2018 21:54:09 UTC] PHP Notice:  Trying to get property of non-object in .../wp-content/mu-plugins/ure-assist/ure-assist.php on line 26

    This is my MU plugin..

    <?php
    
    if ( is_admin() ) {
        add_action('plugins_loaded', 'ure_loaded');
        function ure_loaded() {
    
            if ( defined('URE_VERSION') ) {
              global $pagenow;
              $user = wp_get_current_user();
    
              if (!in_array('webmaster', $user->roles)){
                
                add_filter('ure_show_additional_capabilities_section', 'ure_show_additional_capabilities_section');
                add_filter('ure_bulk_grant_roles',  'ure_show_additional_capabilities_section');
                 
                function ure_show_additional_capabilities_section($show) {
                    if (in_array('admin', $user->roles) || in_array('administrator', $user->roles)) {
                        $show = false;
                    }
    
                    return $show; 
                }
    
                if ($pagenow == 'users.php') {
                  add_action('admin_enqueue_scripts', 'load_admin_style');
                  function load_admin_style() {
                    wp_register_style('ure-styles', plugins_url( '/css/admin.css', __FILE__ ) );
                    wp_enqueue_style('ure-styles');
                  }
                }
              } elseif (in_array('webmaster', $user->roles)) {
                add_filter('ure_supress_administrators_protection', 'remove_ure_administrator_protection', 10, 1);
                function remove_ure_administrator_protection($supress_protection) {
    
                    $supress_protection = true;
                    
                    return $supress_protection;
                }
    
              }
    
            }
        }
    }

    Any ideas?

    in reply to: Permissions non propagating? #4997
    tanner
    Participant

    Oh but, the new role is still showing in the View filter in the users.php page even though it’s blocked. The new role’s users are not showing in the filter list but the filter itself still is.

    In other words, the new Webmaster role is blocked from the Administrator role, but when I go to the Users page, the Webmaster filter is still there. When I click on Webmaster though, it shows no users. How can I remove the Webmaster filter altogether? It doesn’t show up in any other roles where I block it except when I log in with an Administrator.

    in reply to: Permissions non propagating? #4996
    tanner
    Participant

    I cloned the site but unfortunately couldn’t reproduce the issue and the original copy is live and already a tainted because I was fiddling around with it.. when I come across this issue again I’ll message you.

    in reply to: Permissions non propagating? #4989
    tanner
    Participant

    I’ll create a staging site and send it over sometime tomorrow.

    in reply to: Role unable to edit user unless they have #4988
    tanner
    Participant

    I’ve been fiddling with the settings all night and the issue disappeared. I’m wondering if it has to do with the other bug report I submitted. If I can reproduce it I’ll submit another ticket, otherwise you can close this. I have supress_protection turned on as well so it’s possible that I was trying to edit a user with the administrator role.

    tanner
    Participant

    Got this to work. It had to do with my use of is_plugin_active. Not sure why that was erroring out but opted in to using if ( defined('URE_VERSION')) instead

    tanner
    Participant

    I’ve just tried adding

    add_filter('ure_supress_administrators_protection', 'switch_off_ure_administrators_protection', 10, 1);
    function switch_off_ure_administrators_protection($supress_protection) {
    
        $supress_protection = true;
        
        return $supress_protection;
    }

    to the functions.php file for testing gbt it crashes the site.

    tanner
    Participant

    Thanks for the explanation. I see what you’re saying about the super admin. Unfortunately these are single sites so I have to make due with administrator

    tanner
    Participant

    More – URE hides all users with administrator role from any other user with ‘administrator’ role.

    By default, without URE, an administrator user can see all other administrator users. So why is URE blocking the view of other administrator users if they do not have ure_manage_options capability? ure_manage_options is specific to URE.

    tanner
    Participant

    I currently have a work around by creating an admin User Role that has a replica of the administrator role permissions so that I can modify the Other Roles Addon permissions for admin. This applies the latest information you explained, that users with edit_users capability that is not the administrator cannot see the administrator assignment or list by default.

    What I’m not sure about is, when a new plugin is added that should provide the administrator more custom capabilities, do plugins usually provide capabilities to any role with specific capabilities or do they usually provide permissions to the specific administrator role? Without this understanding, I don’t know how effective the work around is and how much future maintenance I will have to deal with if the client decides to add new plugins.

    Can you clarify your statement “as such user is a superadmin there.” Not exactly sure what that means.

    tanner
    Participant

    It also looks like you’re unable to block the the Administrator Role. Makes sense as a precaution but could you provide an option to override this similar to the “Show Administrator role at User Role Editor” option?

Viewing 11 posts - 1 through 11 (of 11 total)