WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Front-end Editor] How to allow a subscriber to edit only their contributed post?

[Resolved] [Plugin: Front-end Editor] How to allow a subscriber to edit only their contributed post?

  • nm

    @nahummadrid

    I’m trying to see if I can allow members of a MU network to edit posts they’ve contributed to sites. Their role is always subscriber.

    If these users visit their post they can see it is available for them to edit? and of course they wouldn’t be allowed to edit any other posts that they havent authored.

    http://wordpress.org/extend/plugins/front-end-editor/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author scribu

    @scribu

    If the ‘subscriber’ role has the ‘edit_posts’ capability on your site, yes, FEE should work as expected.

    Otherwise, try changing their role to ‘contributor’.

    nm

    @nahummadrid

    I was trying to avoid adding or changing of roles of registered members of a multisite network. Members can post to different sites on the network already and their authorship is saved just fine with no role. Otherwise I imagine that would be a pain to manage roles. Also users only post from the fronted so no need for access to the wp-admin posting screen if assigned contributor for example. And I’d hate to have to manage the list of users on each site if I had to assign roles for every poster. Unless there is a reason that users that author a post need to be assigned a role at all…i’m sure there is…but i rather like the clean user lists in the admin.

    Any way to know if the registered/loggedin current_userid matches the author id of the post?

    Plugin Author scribu

    @scribu

    You can use the ‘front_end_editor_allow_post’ filter:

    http://github.com/scribu/wp-front-end-editor/wiki/Actions-and-filters

    function fee_only_own_posts( $allow, $data ) {
        return get_current_user_id() == get_post_field( 'post_author', $data['post_id'] ) );
    }
    add_filter( 'front_end_editor_allow_post', 'fee_only_own_posts', 10, 2 );
    nm

    @nahummadrid

    nice one! tx scribu!

    nm

    @nahummadrid

    Update.

    I thought it was working but it seems to only be working for the superadmin user. As superadmin I can edit my authored post but not others…but as a regular user who’s authored a post, I can’t edit my post.

    nm

    @nahummadrid

    looks like it was still tied to the role capability…the author needs to have the edit_posts capability. I guess i’ll have to assign roles…

    I’ll look to see if there’s a way to bypass this…especially since a registered user’s id is saved as the author id so that should be enough to give them access to edit.

    Plugin Author scribu

    @scribu

    Or you could just add the ‘edit_posts’ capability to the ‘subscriber’ role.

    This is easily done with a plugin, such as Capability Manager.

    nm

    @nahummadrid

    I tried adding the edit_posts capability to subscriber but it wasn’t enough I ended up having to set publish_posts as well…or else the editor wouldn’t load — this was members plugin.

    I’ll try now capability manager

    Plugin Author scribu

    @scribu

    There’s isn’t any point in switching to Capability Manager since they both manipulate the same information.

    I think the capability you’re looking for is actually ‘edit_published_posts’.

    nm

    @nahummadrid

    hehe. No that alone with edit_posts didn’t work, I actually had to have pretty much the same caps as Editor, including publish_posts/page and edit_publish_posts/pages. For the frontend editor to fully load. and by that time I’ve given subscribers acess to wp-admin dashboard so…I’ll need then another plugin to block that. 🙂

    nm

    @nahummadrid

    got it. couldn’t get it to work with subscriber because wp will not recognize them enough to be the author(technically) in the post edit page & for whatever reason wouldn’t take with the increased capabilities. so had to make it contributor so wp would make nice and then give contributor the edit_publish_posts/edit_post cap. thanks for your help… btw I’m no fan of roles and caps. 🙂

    … I do hope to see more improvements on the title tag stuff…because when I turn on the Title field it screws up all my post titles…I looked at the title_attribute thing but I don’t know how much editing I want to do to all the different files but especially plugins and widgets that I can’t edit the title too.

    Plugin Author scribu

    @scribu

    I’m afraid there isn’t anything I can do about the titles.

    The filter is simply applied (wrongly) in too many places.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] [Plugin: Front-end Editor] How to allow a subscriber to edit only their contributed post?’ is closed to new replies.