google-code-export / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
2 stars 1 forks source link

Make it so non-admin users can only view their own images and/or posts #558

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have made the backend for adding images to an image field only display images 
uploaded by the user by:
copying the _image.php file in 
wp-content/plugins/custom-content-type-manager/config/post_selector/ 
and putting it in uploads/cctm/config/post_selector/

Then I have added:

// if user not admin display only own posts
    if ( !current_user_can( 'manage_options' ) ){
          $current_user = wp_get_current_user();
          CCTM::$post_selector['author'] =  $current_user->display_name ;
}

Haven't looked for doing the same for posts, but imagine it would be the same.

Would be useful if this could be integrated into the GUI for custom fields with 
a dropdown to allow either admin, or editor to view all posts/media and any 
lower roles to only view their own

Original issue reported on code.google.com by simonjpa...@gmail.com on 27 May 2014 at 2:59