adminimize icon indicating copy to clipboard operation
adminimize copied to clipboard

Option to see only own posts

Open bueltge opened this issue 13 years ago • 3 comments

users can only see their own posts and unable to see other posts.

bueltge avatar Apr 03 '13 15:04 bueltge

author and contributor roles can see only their own posts like you want. it's setted by capabilities. i don't understand why you want set to editor or admin roles to see only their posts.

if you want that, you must chose another role for your user. Maybe you can manage to create and personalize roles and capabilities. But there are a lot of plugins that work on that.

Maybe you can manage to add a filter on the article list for admin and editor, in this mode they can filter and reduce post to see, maybe you can set this filter for default list view.

my 2 cents

gine avatar Dec 29 '15 10:12 gine

This is a feature which from other users. Currently I will not implement this feature. Thanks for your helpful two cents!

bueltge avatar Dec 29 '15 19:12 bueltge

Also a hint to the support forum, similar question again and again and a small code hint. https://wordpress.org/support/topic/add-your-own-options-example/#post-10119823

function fb_posts_for_current_author($query) {
    global $pagenow;
 
    if ( 'edit.php' !== $pagenow || ! $query->is_admin )
        return $query;
 
    if ( ! current_user_can( 'edit_others_posts' ) ) {
        global $user_ID;
        $query->set( 'author', $user_ID );
    }
    return $query;
}
add_filter( 'pre_get_posts', 'fb_posts_for_current_author' );

bueltge avatar Mar 27 '18 13:03 bueltge