2

I am considering using WordPress for a number of users in overlapping groups, e.g. a user may be in group A and group B, or only group A.

Is it possible to use WordPress to limit access to particular Pages. e.g. Only members of group B can view this page, only members of groups A and C can view that page.

Would this permission extend to the menu item linking to the page? (e.g. if user can't view page, they can't see the menu tab/menu item)

1
  • Yes, it is possible but not everything required is built in. Check out the available plugins, think though what you need in detail, get started, and come back with more specific questions about the actual code. Commented Apr 12, 2013 at 14:06

1 Answer 1

1

That's an interesting question. You could probably Create Custom Roles and use Roles and Capabilities ( codex.wordpress[dot]org/Roles_and_Capabilities ) to your advantage.

You might also be able to add Custom Fields To each User ( wpengineer[dot]com/2173/custom-fields-wordpress-user-profile ) that could help you achieve this goal.

This bit of code below might be helpful as you research. Entering this code in your functions.php file you can restrict a user with a specified capability from accessing the admin area. As you can see below using current_user_can('capability') you can create a function or use an existing function. Then all you need to do is hook into the action that you need.

 /********************* Restrict Admin Area to only Admins **********************/ function restrict_admin() { if ( ! current_user_can( 'manage_options' ) ) { wp_redirect( site_url() ); exit; } } add_action( 'admin_init', 'restrict_admin', 1 ); 

Good luck!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.