How do I let contributors edit their posts after being approved once?
-
16-10-2019 - |
Question
As above
Background info
Main problem: users pay to post an ad on the website
Solution: they sign up as contributors and I publish their posts once the payment is received, after that they can make any edit to their posts
Solution
There is a capability in WordPress called "edit_published_posts". Contributors do not have this capability by default (refer to the Roles and Capabilities Codex page to see the out-of-box role configurations).
You can add this capability to the contributor role with code like this:
// get the "contributor" role object
$obj_existing_role = get_role( 'contributor' );
// add the "organize_gallery" capability
$obj_existing_role->add_cap( 'edit_published_posts' );
This code should only need to be run once--perhaps on activation of a plugin.
If you're not comfortable with code, you can use the Role Scoper plugin (or something like it) to add this capability to the contributor role.