Help Please – Admin emails

Home Forums Plugin Support Help Please – Admin emails

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  sourov amin 7 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8992

    Riaz Budree
    Member

    Hi, I have created a website admin role. They have the ability to approve users and export user lists etc. They can’t do anything else admin related to reduce risk because they don’t need to use any other admin functions.

    How can I get the new user notifications sent through to users with that role, or even to individual email addresses.

    There has to be a way, even if I have to manually edit the plugin code for this purpose, please let me know.

    The custom emails add on, has the ability to make different emails for different user roles but no ability to add that user role to the email list for sending.

    Please help.

    #9001

    Riaz Budree
    Member

    Not the best support for a paid plugin. For anyone else with a similar issue. I used the WP Notifications plugin to override the lack of flexibility in this plugin.

    #9002

    sourov amin
    Moderator

    Hello Riaz,

    Sorry for not getting any response.

    user_meta_admin_email_recipient filter hook is available to solve your mentioned problem.
    You can modify your targetted roles and individual email address through the hook.

    Add something like the following code in the functions.php (under current theme) or any plugin file.

     add_filter( 'user_meta_admin_email_recipient', 'changeEmailRecipient' );
     
     function changeEmailRecipient( $pre ) {
        $emails = (array) $pre;
        $users = get_users( array( 'role__in' => [ 'administrator', 'your_role' ] ) );
        foreach ( $users as $user ){
            $emails[] = $user->user_email;
    	}
    	// add individual email 
    	array_push($emails,'your_email'); 
        
        return array_unique( $emails );
    }
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.