1

I want to know if there's a way to hide pages that do not belong to the logged in user in the dashboard? I've been looking at capabilities, but as far as I can see I can only restrict interaction with pages not owned by the logged in user.

Thanks

Vinc
  • 695
  • 2
  • 10
  • 26

1 Answers1

0

You have to create a new user role and define it's capabilities for the user roles.

add_role( 'photo_uploader', 'Photo Uploader', array( 'view_galleries' ) );
// remove "view_galleries" to this role object
$role->remove_cap( 'photo_uploader', 'view_galleries' );

Check more about custom user roles and capabilities here.

If you are looking for easier and faster solution you can do that using the following plugin

http://wordpress.org/plugins/members/

Gil Sousa
  • 769
  • 5
  • 12
  • Hi I've been looking into this,but the problem is that I don't want to hide all pages from the user. Only ones not owned by him. So a capability won't work as it will block all pages from the user. – Vinc Jun 25 '14 at 09:58
  • You can place a hook at the listing of the pages and change the query to only display pages created by the users. add_filter('manage_event_posts_columns', 'bs_event_table_head'); function bs_event_table_head( $defaults ) { $defaults['author'] = 'Added By'; return $defaults; } – Gil Sousa Jun 26 '14 at 01:35
  • I might be missing something, but that array only has column headers in and does not allow me to change the page list. I looked at other filters and found get_pages() and wp_list_pages(). The former doesn't seem to get called on that specific page and the latter is an html list that would take a lot of string manipulation to do comparisons. Is there something I'm missing or something else I can look at? – Vinc Jun 26 '14 at 08:07