Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$15
Users delete (or edit) their own 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!
Onur | 04/23/11 at 8:23pm
Edit
Previous versions of this question:
04/24/11 at 9:09am
| 04/24/11 at 9:10am
| 04/24/11 at 9:11am
(4) Possible Answers Submitted...
Note: Onur felt their question was unanswered, so we granted them a refund.
Note: Onur requested a refund. They offered this explanation:
"Nobody would be able to support an answer in the way i need."If no one challenges a refund request, then they are automatically granted and proccessed after 48 hours. Admins of this site only review refund requests if someone challenges the request. If you are curious about how we handled previous refund requests, you may read over all refund requests and their challenges.
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
04/23/11
8:30pmLiesl Fawcett says: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.Previous versions of this answer: 04/23/11 at 8:30pm
-

Last edited:
04/23/11
8:53pmDenzel Chia says: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.
DenzelPrevious versions of this answer: 04/23/11 at 8:34pm | 04/23/11 at 8:53pm
- 04/23/11 8:42pm
Denzel Chia says:Hi,
Alternatively, you can use this plugin to solve your problem easily.
http://wordpress.org/extend/plugins/members/
Thanks.
Denzel - 04/23/11 9:00pm
Denzel Chia says:Hi,
Sorry, my code does not work after testing it.
Useless tutorial, just use the plugin instead.
Thanks.
Denzel - 04/24/11 9:15am
Onur says: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? - 04/24/11 9:30am
Denzel Chia says: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 - 04/24/11 9:46am
Denzel Chia says: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. - 04/24/11 10:19am
Onur says:Denzel,
Problem: When i give "edit_others_posts" to subscribers, they are able to edit not only their own comments but also the other users' comments!
* To note: "edit_others_posts" is not enough by itself. I also have to give "edit_published_posts". And then, they can edit not only the comments but also the "Posts". Ok, i can maybe handle this by removing the "publish" button at post.php page. But the problem i wrote above stands still. - 04/24/11 10:21am
Onur says:The problem is: "POST and "COMMENT" is not seperate things in wordpress structure!
- 04/24/11 10:37am
Denzel Chia says:Hi,
if you need subscriber to be able to delete their own comments only and nothing else, not even edit their own comment. You will need custom code, there is no ready solution or capabilities just for this.
I have the following plan for a custom plugin or codes to add to your functions.php
1) Create a new capability for subscriber, call subscriber_delete_own_comment.
2) Create admin menu and use if current user can "subscriber_delete_own_comment" to check that is subscriber, and show admin page only to logged in subscriber.
3) On this admin page, use current user id to retrieve all comments in a list with delete checkbox.
4) Add a processing script so that when user check on delete checkbox and click on submit button, the script can process and delete that comment.
If this sounds good to you and you want to implement it, I will have to charge you by my hourly rate, which is USD$30 per hour and I should be able to get all this up and running around 3 hours.
I do not want to post all the development codes here, because I do not want others to copy my answer. And there is a lot of thick skin copy cats here.
Let me know what you think, my contact is email@denzeldesigns.com
Drop me an email with any additional details if you can accept my idea and rate.
If not I am sure other experts here can come up with a working solution by following my suggested development plan.
Thanks.
Denzel - 04/24/11 10:54am
Onur says:Denzel,
I said "only delete not even editing" to simplify the complexity of my need. Of course, if it is easier to "both editing and deleting" then i will choose that way, why not.
- 04/24/11 11:06am
Denzel Chia says:Add editing will add on more time in coding. Yes you can have both editing and deleting.
Thanks. - 04/24/11 11:31am
Denzel Chia says:Hi,
I don't want to waste anymore time here.
Are you willing to pay my rate and hire me to do this plugin for you?
Thanks.
Denzel - 04/24/11 12:13pm
Onur says:Denzel,
Thank you for your offer. I will keep it in my mind. However, at the moment i will try to handle the issue with other solutions. (ajax plugins at worst case)
But i can come to you with other types of improvements.
- 04/23/11 8:42pm
-
Last edited:
04/23/11
9:26pmDuncan O'Neill says:Hi Onur,
this is untested, but from my reading *, should work. In functions.php add;
*
http://codex.wordpress.org/Roles_and_Capabilities#edit_published_posts"
$role=get_role('subscriber');
$role->add_cap('edit_published_posts');
best,
DuncanPrevious versions of this answer: 04/23/11 at 9:25pm | 04/23/11 at 9:26pm
- 04/24/11 8:47am
Onur says:I use User Role Editor plugin to control the capabilities of user roles.
I gave "edit_published_posts" to subscribers. But it is not enough. They still need to get: "edit_others_posts" authorization to be able to edit their own comments which were written under other people's posts. However, when they get this, they are able to edit posts, which i don't want.
It is very strange that, these 2 capabilities are not seperated from each other as wordpress default :( - 04/24/11 9:06am
Duncan O'Neill says:Onur,
yes, in theory the cap 'edit_comment' should do it;
http://codex.wordpress.org/Roles_and_Capabilities#edit_comment
But it seems there is an 'enhancement' recently ( 9 months ago ) , which was supposed to have sorted the issue out;
http://core.trac.wordpress.org/ticket/14520
But that involves editing core files. If you're brave enough to do it, perhaps the reference above might work for you.
best,
Duncan
- 04/24/11 8:47am
-

Last edited:
04/25/11
5:43amRashad Aliyev says:Dear Onur,
Look at this plugin, maybe you can find most of needs there.
http://wordpress.org/extend/plugins/wp-ajax-edit-comments/
Not: Yaşamış olduğunuz sorunlarda yardımcı ola bilirsem ne mutlu bana.
best regards,- 04/25/11 6:00am
Onur says:I know this plugin . However, as i wrote in my message, i was looking for solutions other than ajax plugins. (a bit code tweaking would be great)
But seems like, there is not an easy solution :(
Neredensiniz bu arada? :)
- 04/25/11 6:00am
This question has expired.
Current status of this question: Refunded
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
