Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Users delete (or edit) their own comments WordPress

  • REFUNDED

In my site, only registered user can comment. I want them to be able to delete (or edit) their comments.

My site uses user roles. There are authors who can edit posts, and subscribers who can enter only comments. Authors can edit their comments, but subscribers can not. (they need "edit_others_post" role to be able to edit their comments)

There are some ajax plugins to solve this issue. Some of them use "IP" control which i don't want.

Isn't it possible to do it with some code tweaking?

I even don't need "editing". Just "deleting" would even do great job!

Answers (4)

2011-04-23

Liesl Fawcett answers:

I use the Capability Manager plugin on my WordPress sites. There is a capability option within the plugin's settings that you can use to allow your users to edit/delete their comments.
http://wordpress.org/extend/plugins/capsman/

EDIT: Nevermind, that option would allow them to edit others' comments as well... I will do some more research to figure this out for you.

2011-04-23

Denzel Chia answers:

Hi,

With reference to this tutorial http://new2wp.com/snippet/add-capabilities-to-user-roles-in-wordpress-easy/

Please try the below add capabilities code in your functions.php
Please try it on your test server, or localhost and not live server.


function update_caps() {
$role = get_role( 'subscriber' );

$caps_to_add = array(
'edit_others_posts',
);

foreach( $caps_to_add as $cap )
$role->add_cap( $cap );
}
add_action('init','update_caps');


Thanks.
Denzel


Denzel Chia comments:

Hi,

Alternatively, you can use this plugin to solve your problem easily.
http://wordpress.org/extend/plugins/members/

Thanks.
Denzel


Denzel Chia comments:

Hi,

Sorry, my code does not work after testing it.
Useless tutorial, just use the plugin instead.

Thanks.
Denzel


Onur comments:

Hi Denzel,

I will now just try the plugin, however members seems to be old and dont get updated. There is a very comprehensive role editor plugin: Role Scoper (1.3.29)

Do you insist on using Members plugin or it doesnt matter?


Denzel Chia comments:

Hi Onur,

I had used this plugin before, you can create role and assign capabilities by simply selecting,
or assigning capabilities to existing wordpress roles by simply selecting. This plugin is by Justin Tadlock, I don't think he will abandon this plugin project.

Thanks.
Denzel


Denzel Chia comments:

Hi,

I had attached the screenshot of the edit subscriber role setting, you can check on any wordpress capabilities to assign it to subscriber.

Thanks.