[wp-hackers] User who can only moderate comments

Gaurav Aggarwal gaurav91.2008 at gmail.com
Thu Mar 3 08:04:48 UTC 2011


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.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
regards,

Gaurav Aggarwal
IIIrd year student
Computers Engineering
Delhi College of Engineering


More information about the wp-hackers mailing list