WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Plugin To Limit What User Sees? (7 posts)

  1. trivum
    Member
    Posted 6 years ago #

    I've looked around for this, but I can't find what I need.

    Is there a plugin that will limit a user so that they see only the posts that they made in the backend?

    As it stands, when they go to manage posts, it seems that they see all the posts that all the users have made, however they can only edit their own, of course.

    I'm trying to make it so that they only see their own posts in the backend.

    Thanks in advance for any suggestions.

  2. trivum
    Member
    Posted 6 years ago #

    Anyone with ideas for this?

    Thanks.

  3. MichaelH
    Member
    Posted 6 years ago #

    Might look at http://www.coppit.org/code/ Category Access plugin for lack of anything else.

    There is the Role Manager Plugin (see Resources at Roles and Capabilities).

  4. trivum
    Member
    Posted 6 years ago #

    Thanks for the suggestions.

    I already use the Role Manager, and that doesn't quite do it.

    I checked out the other plugin, and that doesn't do it either. It seems to limit what they can read on the frontend, not on the backend.

    Unfortunately, I don't know how to write the code, but I think I can figure out how to do. Someone can correct me if I'm wrong.

    It seems you could check to see the user's permission level, and if they didn't have permission to edit other's posts, you would return only the posts written by them in the Manage Posts section.

    It seems simple enough to me, but then, as I said, I don't know how to code. For those who know about these things, would this be a simple plugin to make?

  5. trivum
    Member
    Posted 6 years ago #

    OK, I just noticed something that I hadn't before. When I'm logged in as Admin, I can filter the Manage Posts by Author, however when I log in as a contributor, that filter isn't an option.

    So at least it seems that filtering out all the other authors completely is very possible (especially with a plugin, which is what I'm hoping for).

    It's a little puzzling to me why the default for someone in a contributor's role would be to see all the posts on the blog rather than just their own. If they can't edit those posts, I can't see why they should be presented with them. They only have to wade through them to find their own.

  6. trivum
    Member
    Posted 6 years ago #

    Finally found an answer to this on this thread.

    There are two suggestions. The first didn't work for me, but the second one did.

    It also looks like the code has changed a little since that answer, so I just copied the end of the new code into the replacement code, although the orignal replacement code also worked.

    I'll go ahead and give the solution that worked for me.

    Go to wp-admin/edit.php and find the lines

    wp
    ("what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");

    You can delete that, or even better just comment it out so that it's still there if you need to change things back. You can comment it out by putting /* at the beginning and */ at the end so that it looks like this:

    /*wp("what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");*/

    Now put in the new replacement code:

    $thisauthor='';
    if (!current_user_can('edit_others_posts'))
    $thisauthor = '&author=' . $user_ID;
    wp('what_to_show=posts&posts_per_page=15&order=$order&orderby=$orderby' . $thisauthor);
  7. trivum
    Member
    Posted 6 years ago #

    An update on this code. It should be the following:

    $thisauthor='';
    if (!current_user_can('edit_others_posts'))
    $thisauthor = '&author=' . $user_ID;
    wp("what_to_show=posts$post_status_q&posts_per_page&=15&order=$order&orderby=$orderby" . $thisauthor);

    Why it changed.

Topic Closed

This topic has been closed to new replies.

About this Topic