Support » Plugin: User Role Editor » Undefined property: URE_User_View::$multisite in debug.log

  • Hello Vladimar,

    I’m trying to troubleshoot another problem where I have assigned capabilities for a sales manager, but when try to look at a woocommmerce order they are immediately logged out.

    I set WP_DEBUG in the wp_config to true to see if any messages were generated and I’m seeing this: [06-Jul-2021 17:13:12 UTC] PHP Notice: Undefined property: URE_User_View::$multisite in /wp-content/plugins/user-role-editor/includes/classes/user-view.php on line 145

    Any advice on how to troubleshoot my other problem would be greatly appreciated.

    • This topic was modified 10 months, 3 weeks ago by kruddock.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Vladimir Garagulia

    (@shinephp)

    Hi,

    You can replace mentioned line #145 with this version:

    
    if ($this->lib->is_super_admin() || !is_multisite() || !class_exists('User_Role_Editor_Pro') || !$caps_access_restrict_for_simple_admin) {  
    

    to exclude the warning about undefined URE_User_View::#multisite property.

    I will fix this with the next update. Thank you.

    A you sure that user is really logged-out, but not just redirected to the front-end?

    Thread Starter kruddock

    (@kruddock)

    I tried fixing on my own, adding this line under other variable declarations in function display()

    $multisite = $this->lib->get('multisite'); //kbr 070621

    I will use your fix and remove my own.

    I think I managed to track down why my shop_manager was getting logged-out/redirected back to the login page. I was working in our staging site, the staging site is created by a plugin called wp-staging. I discovered that I needed the General->manage_options capability checked ON in our staging site, otherwise the logout/redirection occurs.

    On our live production site, this General->manage_options is checked OFF and everything works as normal… no forced logout/redirection occurs. Any Ideas why this needs to be checked on our staging site?

    BTW, Thanks for the code fix.

    Plugin Author Vladimir Garagulia

    (@shinephp)

    It’s a built-in logic of WP Staging plugin for the staging site. Look at the Frontend/Frontend.php file, lines #72, #101, etc.

    /**
         * Check permissions for the page to decide whether or not to disable the page
         */
        public function checkPermissions()
        {
            $this->resetPermaLinks();
    
            if ($this->showLoginForm()) {
                $login = new LoginForm();
                if ($this->accessDenied) {
                    wp_logout();
                    $login->setError(__('Access Denied'));
                }
                $overrides = [
                    'label_username' => __('Username or Email Address'),
                ];
                $login->renderForm($login->getDefaultArguments($overrides));
                die();
            }
        }
    
        /**
         * Show a login form if user is not authorized
         * @return bool
         */
        private function showLoginForm()
        {
            $this->accessDenied = false;
    
            if ($this->isLoginPage() || is_admin()) {
                return false;
            }
    
            if (! $this->isStagingSite()) {
                return false;
            }
    
            // Allow access for administrator
            if (current_user_can('manage_options')) {
                return false;
            }
    Thread Starter kruddock

    (@kruddock)

    Thank you Vladimar for going a little extra to help us understand things when they do not work.

    The whole idea behind setting up a staging site is so that you can experiment with new plugins and their settings before you try and go live. It is apparent that wp-staging is overriding some of your plugin URE settings on our staging site.

    I noticed this when I log into our staging site with a role of sales manager (for us this is a tweaked version of shop manager role). The staging plugin must be overriding the URE plugin as I am able to see most of the admin dashboard. On the production site the URE plugin is working fine and I do not see most of the admin dashboard.

    I’ve sent an email to wp-staging technical support with this thread as a reference.

    • This reply was modified 10 months, 3 weeks ago by kruddock.
    • This reply was modified 10 months, 3 weeks ago by kruddock.
    • This reply was modified 10 months, 3 weeks ago by kruddock.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Undefined property: URE_User_View::$multisite in debug.log’ is closed to new replies.