Change WordPress user roles and capabilities Forums How to or FAQ Event category taxonomy not accessible, need to allow it to be selected

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8721
    Andy Burns
    Participant

    I am using the “Activate user access management to edit selected posts, pages, custom post types” to give specific users access to a custom post type data by using a “garden-assignments” taxonomy tag that extends events and garden CPT’s.

    I grant the given ID for their garden assignment on their user profile “with category/taxonomy ID (comma separated)” and they can then see those gardens and events in the admin.

    However, they are unable to assign an “event-category” taxonomy from the event organiser plugin. They do see the event category meta box, just no category options show in it.

    I have debugged it to where it is the “Activate user access management to editing selected posts, pages, custom post types”. The only way to allow them to select the proper event category is to put the array of event-category id’s into the “post edit” option at the role level in the URE config. Of course, that negates the permissions setup and reason for using this module in the first place as it gives too much access to any event with those category.

    Is there a config that I am missing or can you provide some code guidance via a filter that excludes event-category taxonomy from the URE’s consideration, specifically the functionality behind Activate user access management to editing selected posts, pages, custom post types? The goal is to allow anyone that can edit an event to assign an event-category taxonomy.

    #8722
    Andy Burns
    Participant

    So the question is how can I use “with category/taxonomy ID (comma separated)” and exclude “event-category” taxonomy from that functionality?

    #8724
    Vladimir
    Keymaster

    Try this filter ‘ure_post_edit_access_restricted_taxonomies’. For example, I excluded post tags from edit restrictions and restricted user can assign tags to the edited post inspite of those IDs, were not included into allowed categories/taxonomies list.

    
    add_filter('ure_post_edit_access_restricted_taxonomies', 'not_restrict_tags', 10, 1);
    
    function not_restrict_tags( $taxonomies ) {
            
        foreach( $taxonomies as $key=>$taxonomy ) {
           if ( $taxonomy==='post_tag' ) {
                unset( $taxonomies[$key] );
           }            
        }
        return $taxonomies;
    }
    
    #8725
    Andy Burns
    Participant

    Excellent, this works perfectly. Thank you!

    I didn’t see ‘ure_post_edit_access_restricted_taxonomies’ filter documented on https://www.role-editor.com/documentation/hooks/, can you add it?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.