Posted: May 26, 2015 at 2:09 pm
|
I am using WordPress 4.2.2 and EE3. With the latest updates the users with custom roles (I created one called Manager for the website client) can no longer edit their events. They can create them, just not edit. It was working great before these updates. We do not want to have to make these user Espresso Master Admins as we have other uses for the Manager role pertaining to their website. I installed the plugin User Role Editor to check if there were issues were maybe the Manager role wasn’t getting the espresso_group_admin, espresso_event_admin & espresso_event_manager capabilities, but they were set correctly. I have also checked the database to make sure the user ID’s match for the event and the user and they match. All of the EE3 plugins and the core are up to date. Please help. |
Hi Michael, I’m not sure how that’s set up to allow a custom role to manage events, since it’s not a built in feature of the basic R&P plugin. When you go to the Event Espresso > User Permissions page, does it let you select other user roles besides Administrator and Event Admin? If you can outline the steps for how the custom manager role was set up to allow managing events I can investigate. |
|
|
Yes I can see the custom role in User Permissions. I created the Manager role in functions file for the theme using basically the same code that creates the administrator role for the core. I also added the three capabilities: espresso_group_admin, espresso_event_admin & espresso_event_manager at that level just in case. It worked up until the latest updates of both WP and EE3. |
Can you post a link here to a gist of that function so I have something to work with? |
|
|
here is the code add_role( ‘manager’, ‘Manager’); |
I created a new role with your code and it does not show up in any of the dropdowns under Minimum Page Permissions in Event Espresso > User Permissions. Since that’s the case, I need to know if there are any customizations on your site that were made directly to the Roles and Permissions plugin, or any functions added to override its default functionality? |
|
|
I have not made any customizations to the plugin or any overrides. |
Can you double check on something? This is the code that’s in the roles and permissions plugin, on lines 491 – 504 of espresso-permissions.php: $values=array( array('id'=>'administrator','text'=> __('Administrator','event_espresso')), array('id'=>'espresso_event_admin','text'=> __('Event Admin','event_espresso')), ); //OVerride the values array if the pro version is installed if (function_exists('espresso_manager_pro_options')) { $values=array( array('id'=>'administrator','text'=> __('Administrator','event_espresso')), array('id'=>'espresso_event_admin','text'=> __('Master Admin','event_espresso')), array('id'=>'espresso_event_manager','text'=> __('Event Manager','event_espresso')), array('id'=>'espresso_group_admin','text'=> __('Regional Manager','event_espresso')) ); } You’ll note there isn’t a “Manager” role included in the $values array, which means a Manager option should not be included in the Event Espresso > Permissions setting dropdown selects. |
|
Can you compare your copy of the roles and permissions plugin with the above? |
|
|
It matches. Is there a way for me to include Manager in that array? |
I would not advise to add to the array. I’m trying to find out how Manager is being included in the dropdown selects there because you earlier wrote:
|
|
|
I don’t see it in permissions, sorry, I see it on the roles page. I only see the two (Administrator & Espresso Master Admin) in permissions. |
Thanks for the clarification. Here’s what I think is happening: there’s a check to make sure that only event managers can edit their own events, and your custom role is getting caught in that check. There’s a function that you can add to a custom snippets plugin to override how it checks for this. Here’s some example code: if (!function_exists('espresso_is_my_event')) { function espresso_is_my_event($event_id){ global $wpdb; if( current_user_can('delete_others_pages') || espresso_member_data('role')=='espresso_event_admin'){ return true; } } } Note that the above checks for ‘delete_others_pages’ cap. That should work since you’ve given the Manager role the ‘delete_others_pages’ cap. |
|
The support post ‘Custom Role permission issues with EE3’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.