I’ve been using this plugin together with Woocommerce, Groups and Groups for Woocommerce.
I’m trying to set 2 groups capability to one events post but everytime I try to save the post, the selected capabilities does not seem to be saved, even if you have saved 1 group capability before, it seems the save only removes any groups capabilities attached to that post. It won’t happen if I set only 1 capability to the post, but when selecting more then 1, then the problem occurred.
I initially post a message in Groups' support forum and got their reply saying that it has something to do with capabilities.
Excerpt of what Kento from itthinx found out are as follows:
When you try to restrict access by checking the boxes, Groups verifies (*) that you actually are allowed to do that using the current_user_can(...) function provided by WordPress. The execution flow of that function results in the map_meta_cap filter being triggered via WP_User‘s has_cap< ( $cap ) which invokes the map_meta_cap(...) function defined in capabilities.php.
(*) The call through Groups_Access_Meta_Boxes::save_post(...) results in two parameters being passed to map_meta_cap(...), 'edit_event' and the current user's ID. The third parameters that em_map_meta_cap(...) expects to be there isn't, because it's not about the post but just about the user.
Events Manager hooks itself into the map_meta_cap filter and erroneously returns an empty array of capabilities for a user who tries to edit an event when the call happens in Groups_Access_Meta_Boxes::save_post(...).
This notice is thrown out:
Notice: Trying to get property of non-object in /var/www/wptest/wp-content/plugins/events-manager/em-posts.php on line 318
because $post_type on that call is missing the property capem_map_meta_cap(...), this is going to fail.
Any help would be appreciated.
Thanks in advance.