0

I am managing a Wordpress website for a local sports club, the navigation is something like this:

  • home
  • division
    • archery
    • soccer
      • youth
      • senior
    • volleyball
  • ...

I want to enable the people in charge of a division to edit the content of their divisions page and subpages (e.g. person responsible for soccer can change the pages soccer, soccer-youth and soccer-senior), but not the pages for other divisions.

Is this possible with out of the box functionality? Or is there an extension I need?

Bonus question: These users can write blog posts, too ... can I block some of the categories, so they don't see/can't choose them for their blog posts?

  • Seems the normality for me: An author can edit_posts but not like an editor edit_others_posts. Did I miss something? – realloc Oct 30 '13 at 13:50
  • This may be normal, but I never used it ... so I should set the role of the user to "author"? And how do I assign the user to the page? Can I assign him even though I created the page for him? ... If you have a link to a tutorial I would gladly accept it as answer ... – Hinek Oct 30 '13 at 13:57
  • I now created as user as "author" and set him as the author of two pages. But when I log in as the user, he can only create posts, but cannot change the two pages (doesn't see the menu item "pages" at all) ... – Hinek Oct 30 '13 at 14:11
  • Let me know if the code I provided was helpful. – realloc Oct 30 '13 at 16:26
2

An author can *edit_posts* but can not *edit_pages*. Personally I prefer in such a case to create a new role which gets the capabilities as needed. A quick shot for a solution of your problem in a custom plugin would be:

namespace WPSE\realloc;

function activate( $network_wide ) {
    add_role(
        'division',
        __( 'people in charge of a division' ), 
        array(
            'read'       => true,
            'edit_pages' => true,
            'edit_posts' => true,
        )
    );
}
register_activation_hook( __FILE__, __NAMESPACE__ . '\\activate' );

function remove_meta_box() {
    if ( ! current_user_can( 'manage_options' ) ) {
        remove_meta_box( 'categorydiv', 'post', 'side' );
    }
}
add_action( 'do_meta_boxes', __NAMESPACE__ . '\\remove_meta_box' );

And you can like in my example decide to remove the meta_box of the category selector if your normal users should not choose the category of their posts.

  • Hi, thanks, that helped. But instead of the code I found an plugin, called "User Role Editor", that did the job for me. – Hinek Oct 31 '13 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.