WordPress.org

Support

Support » How-To and Troubleshooting » how do i prevent users from editing eachother’s posts?

how do i prevent users from editing eachother’s posts?

  • i’ve noticed all users have the ability to edit eachother’s blogs by default. is there a way to limit users to edit their own posts only?

    thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m having the same problem

    You can get the edit buttons to disappear by making the following edits to “template-functions-links.php” in “wp-includes”:
    Locate the function “edit_post_link”. Replace the whole thing with this:

    function edit_post_link($link = ‘Edit This’, $before = ”, $after = ”) {
    global $user_level,$post,$user_login;

    get_currentuserinfo();

    if ($user_level > 0) {
    $authordata = get_userdata($post->post_author);
    if ($user_level <= $authordata->user_level && $user_login != $authordata->user_login) {
    return;
    }
    } else {
    return;
    }

    $location = get_settings(‘siteurl’) . “/wp-admin/post.php?action=edit&post=$post->ID”;
    echo “$before $link $after”;
    }

    This makes it so that only the person who posted the post can edit their post, unless your a higher level. E.g. Admin see’s ‘Edit This’ for all posts, but level 1 user only see’s ‘Edit This’ for their own posts and level 2 users can see ‘Edit This’ for their own posts as well as all level 1 user’s posts.

    Oh, and this is secure. If you change the link, it won’t let you edit the post unless you’re logged in as the user.

    “i’ve noticed all users have the ability to edit eachother’s blogs by default.”

    Yikes really? Not good. I suppose the apparently non-killable comment moderation feature/bug would throw this into the lap of the admin, but is there really no GUI-settable user setting to limit users’ ability to edit eachothers’ blog?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how do i prevent users from editing eachother’s posts?’ is closed to new replies.
Skip to toolbar