[wp-hackers] User who can only moderate comments

Blake Baxendell blake at tayloegray.com
Wed Mar 2 21:54:43 UTC 2011


I am trying to add a user who can moderate comments but not do anything else.

I am using the following code, but the user can only see the comments, but not approve or mark them as spam.  the links are just not there.  


	$_the_roles = new WP_Roles();
	$_copy_from = 'contributor';
	$_extra_caps = array(
		'moderate_comments' => 1
		// Each capability you want to grant the new role should follow the same format as above
		// Key = Capability
		// Value = 1 (grant, 0 would be deny but we don't typically add non-granted caps to roles)
	);
	$_caps_for_role = array_merge( $_extra_caps, (array)$_the_roles->roles[$_copy_from]['capabilities'] );

	add_role('comment_moderator', 'Comment Moderator', $_caps_for_role );


I would prefer to do this with a function.php code, not a role scoping plugin,

thanks in advance,

Blake.


More information about the wp-hackers mailing list