Allow users to set a post author

The edit_others_posts capability should allow users to set the author of a post. At first glance you might reply that you don’t want your authors to be able to edit one another’s posts. The difference in ability is very subtle though: writing a post and then assigning it to another user isn’t much different from … Read more

Multiple Authors on Single Post

I want to throw this out there as an answer to the question. I have stumbled across a plugin that will take WordPress’s permissions to the next level. It is called Press Permit. http://presspermit.com/extensions/pp-collaborative-editing/ Taken from Press Permit FAQ’s: How does Press Permit compare to Capability Manager, User Role Editor and other role editor plugins? … Read more

Check whether user can delete a given post

After hours of fighting to get this to work, it was just a matter of changing delete_posts to delete_post. So, in it’s entirety this would be: current_user_can(‘delete_posts’, $post_id); to current_user_can(‘delete_post’, $post_id); current_user_can does accept a second parameter. Though it’s weird that the function declaration in capabilities.php does not define a second parameter as pointed out … Read more

How can I prevent a writer from being able to edit an article that has been scheduled?

Me, like @fischi think that filter ‘user_has_cap’ is the best choiche for the pourpose, however, I think that is better to the work, regardless the $_GET post or action: WordPress check the meta cabability on a per-post basis, using an additional argument. In few words, when filtering ‘user_has_cap’ for a meta capability (see https://codex.wordpress.org/Function_Reference/map_meta_cap) we … Read more

add_cap only adding the first two in array

Looking at your code I think you are trying to modify the capabilities of existent roles. Am I right? To do that you have to run the add_cap for a role object, not for a user object. Also, you must know that add_cap only accept one capability as string: $role = get_role( ‘editor’ ); $role->add_cap( … Read more

Listing all capabilities in dropdown is returning boolean

Solved with this Answer at Stack Overflow. Each Array Key was the actual name of the capability […] You were searching for the capabilities by name, and since you were only seeing 1s in the output, I figured what you were looking for was in the keys. foreach($capslist as $cap=>$caps){ $dropdown .= ‘<option value=”‘.$cap.'”>’.$cap.'</option>’; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)