Change WordPress user roles and capabilities Forums Bug Reports Activating User Role Editor Pro breaks my website Reply To: Activating User Role Editor Pro breaks my website

#2022
Vladimir
Keymaster

Hi Nancy,

Thanks for the information. I will enhance this part of the code and include it to the next update.

It seems that WP_DEBUG constant is set to true at your site. It’s not recommended for the live sites. So 1st workaround is to set it to false at wp-config.php file.
2nd way is to modify wp-content/plugins/user-role-editor-pro/includes/pro/classes/other-roles.php file replacing code phragment at lines 72-89 with this one:


        if (is_array($user->roles)) {
            foreach ($user->roles as $role) {
                if (isset($access_data[$role])) {
                    if (!isset($access_data[$role]['access_model'])) { // for backward compatibility
                        $access_model = 1;   // Use default (block selected) access model
                        $data = $access_data[$role];
                    } else {
                        $access_model = $access_data[$role]['access_model'];
                        $data = $access_data[$role]['data'];
                    }
                    if (empty($blocked['access_model'])) {  
                        $blocked['access_model'] = $access_model;    // take the 1st found role's access model as the main one                    
                    }
                    // take into account data with the same access model only as the 1st one found
                    if ($access_model==$blocked['access_model']) {
                        $blocked['data'] = array_merge($blocked['data'], $data);
                    }
                }
            }
        }

That is insert
if (is_array($user->roles)) { just before it. And insert closing } just after it.
I may send a modified file to your e-mail if it’s required.