WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Events Manager + Groups plugin (7 posts)

  1. che-mat
    Member
    Posted 1 year ago #

    Hi,

    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.

    Full message:
    http://www.itthinx.com/plugins/groups/#comment-3462

    Any help would be appreciated.

    Thanks in advance.

    http://wordpress.org/extend/plugins/events-manager/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    I replied on there, but for posterity:

    Hey Kento, Marcus here, EM dev.

    I'll need to test out your plugin to verify this for sure (some time will be needed for this), but looking at a simple example - http://justintadlock.com/archives/2010/07/10/meta-capabilities-for-custom-post-types

    you'll see that the $post_type, which is what I'm retreiving from $args, should be available to me.

    are you sure its not something on your side? if you have any ideas in the meantime that'd be great.

  3. itthinx
    Member
    Posted 1 year ago #

    Marcus in case you haven't seen it, I'm proposing a patch that fixes the issue: http://www.itthinx.com/plugins/groups/#comment-3807

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    Thanks, I've noted this down and will test/implement asap.

    It'll have to be end of next week or first days of Jan due to the holidays (on that note, happy holidays!)

  5. itthinx
    Member
    Posted 1 year ago #

    That's great Marcus, have a joyful time & Happy Holidays *<:-)

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    cheers, hope you had a good xmas time and have a happy new year :=)

    will let you know when this is sorted out.

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    just to update you all here, the latest update 5.3.3 has itthinx's update which should fix the issue

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic