• Hello,

    We plan to use WPADVERTS to publish adverts in our WordPress based intranet.

    We would like that different groups of users can manage independently corporate posts and adverts.

    In our understanding, it is required to give manage post rights to the group intended to manage adverts (for example to remove old or inappropriate adverts). If we do so they will be able to delete any post.

    Is there a way to limit the management rigths only to advert type posts?

    Is it a missed configuration or should we buy an addon or…?

    Thank you.

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    i understand that the group which will be managing the Ads will be able to do that from wp-admin / Classifieds panel?

    If so then by default any user who has access to editing posts and pages will be also able to manage Adverts.

    You should be able to create a new user group (a role) with the following capabilities ‘edit_advert’, ‘read_advert’, ‘delete_advert’, ‘edit_adverts’, ‘edit_others_adverts’, ‘publish_adverts’, ‘read_private_adverts’.

    Then add the below code in your theme functions.php file

    
    add_filter( "adverts_post_type", function( $args, $type ) {
        if( $type != "advert" ) {
            return $args;
        }
        $args['capabilities'] = array(
            'edit_post' => 'edit_advert',
            'edit_posts' => 'edit_adverts',
            'edit_others_posts' => 'edit_other_adverts',
            'publish_posts' => 'publish_advert',
            'read_post' => 'read_advert',
            'read_private_posts' => 'read_private_adverts',
            'delete_post' => 'delete_advert'
        );
        return $args;
    }, 10, 2 );
    

    Then only users with those capabilities will be able to see the wp-admin / Classifieds page and manage the classifieds ads, which means you might also need to add these capabilities to the Administrator and Editor roles although i am not sure to be honest as i never tested the custom capabilities functionality.

Viewing 1 replies (of 1 total)
  • The topic ‘User’s rights required to manage adverts’ is closed to new replies.