• I have give Editors these capabilities:

    $edit_editor = get_role('editor'); // Get the user role
            $edit_editor->add_cap('edit_users');
            $edit_editor->add_cap('list_users');
            $edit_editor->add_cap('promote_users');
            $edit_editor->add_cap('create_users');
            $edit_editor->add_cap('add_users');
            $edit_editor->add_cap('delete_users');

    Now I would like the Editor to also receive email about a new pending user.
    Is it possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    By default, emails about new users is only sent to the email address set in general settings. The email is sent by the function wp_new_user_notification(), which is a pluggable function, meaning you can define your own version and it will be used instead. Copy the function declaration from wp-includes/pluggbale.php to your theme’s functions.php. Better yet, to a child theme’s functions.php. Edit your version by adding additional @wp_mail() lines to send messages to whomever else you want.

    You can query for users with a certain role with get_users(), which returns an array of WP_User objects, each of which contains the user’s email.

    Thread Starter oivind

    (@oivind)

    That was a really helpful answer!
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Email about pending user, What capability?’ is closed to new replies.