Change WordPress user roles and capabilities › Forums › Bug Reports › Activating User Role Editor Pro breaks my website
- This topic has 3 replies, 2 voices, and was last updated 8 years, 9 months ago by Vladimir.
-
AuthorPosts
-
22/02/2016 at 10:15 #2021orangesandlimeParticipant
Hi!
I’m getting the following error message when activating the User Role Editor Pro plugin:
Warning: Invalid argument supplied for foreach() in wp-content/plugins/user-role-editor-pro/includes/pro/classes/other-roles.php on line 72
Warning: Cannot modify header information – headers already sent by (output started at wp-content/plugins/user-role-editor-pro/includes/pro/classes/other-roles.php:72) in /home/redlovec/public_html/wp-includes/pluggable.php on line 1207
and my website doesn’t load.
I have deactivated the plugin for now.
Pleas advise. Thank you!
Nancy
22/02/2016 at 23:52 #2022VladimirKeymasterHi 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 tofalse
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.23/02/2016 at 12:32 #2024orangesandlimeParticipantHi Vladimir,
Thank you so much for getting back to me. That did the trick! User Role Editor is working perfectly now.
Cheers,
Nancy24/02/2016 at 02:49 #2027VladimirKeymasterHi Nancy,
Thanks for the feedback.
-
AuthorPosts
- You must be logged in to reply to this topic.