[wp-hackers] User who can only moderate comments

Blake Baxendell blake at tayloegray.com
Thu Mar 3 16:10:48 UTC 2011


Gaurav,
  Thank you very much for the plug-in.   It does work and does what I need.
  I am still looking for a way though to do it in the function.php area
instead of installing another plug-in into my database.  If anyone knows, I
appreciate the help in advance.

Blake





--------- Forwarded message ----------
From: Gaurav Aggarwal <gaurav91.2008 at gmail.com>
To: wp-hackers at lists.automattic.com
Date: Thu, 3 Mar 2011 13:34:48 +0530
Subject: Re: [wp-hackers] User who can only moderate comments
Why don't you try http://www.shinephp.com/user-role-editor-wordpress-plugin/

On Thu, Mar 3, 2011 at 3:24 AM, Blake Baxendell <blake at tayloegray.com>
wrote:
> 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