How to let users to delete their own posts (WP 3.5.1)
-
Hello
There is my issue. I’m running the WP website where the users in role SUBSCRIBER can log in, in front end editor write something, add/upload pictures, videos, etc. and finally PUBLISH their posts.
I “user role editor” for this, where I allowed users to:
– level 0
– edit_others_pages
– edit_published_pages
– read
– upload_filesAll this is needed to upload the files, publish the posts for SUBSCRIEBERS. But! users cannot see anything in the dashboard except their profile. They cannot access backend at all, only frontend using wysiwyg editor.
Sometimes they publish something by mistake, they want to edit those posts, but because of the whole context I cannot allow them to access backend, so I decided to allow them to DELETE their post with simple clicking “delete button” in published post.
I used this code:
<?php if ($post->post_author == $current_user->ID) { ?> <a onclick="return confirm('Are you sure?')" href="<?php echo get_delete_post_link( $post->ID ) ?>"><b><font color="red">DELETE POST</font></b></a> <?php } ?>
Sure, this works perfectly for admin, but not for my users “subscribers”.
So finally my question:
Do you know what role I should allow for my users to be able to download their OWN posts? These are common users, anybody can log in, so the solution should be SECURE. do not allow them to delete others posts, access backend, etc.
Can you give me another advice for this, another solution?The aim is to “hide” the post from frontend, so this means the solution can be also just changing the “status” for the post, from “published” to “waiting for approval”, “concept”, etc. So then I can manually delete those posts in backend all at once.
Please, help me with this, no matter how, just bring me one possible solution.
Thank you.
- The topic ‘How to let users to delete their own posts (WP 3.5.1)’ is closed to new replies.