WordPress.org

Forums

how do i prevent users from editing eachother's posts? (4 posts)

  1. cvanderjagt
    Member
    Posted 10 years ago #

    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.

  2. johnnyroxxor
    Member
    Posted 10 years ago #

    I'm having the same problem

  3. johnnyroxxor
    Member
    Posted 10 years ago #

    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.

  4. eetdcob
    Member
    Posted 10 years ago #

    "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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.