BuddyDev

Search

[Resolved] Email Notification for two role

  • Participant
    Level: Initiated
    Posts: 6
    mekcas on #26377

    hello buddypress. I want to ask.

    Right now I have done create a registration page for new user using buddypress and buddy xprofile field.
    after user have success registration, they will get welcome email.

    How can I add another role (which is Officer) to get email notification regarding “new user have register”?

    I can’t find the setting for this function. or any code can I edit?

  • Participant
    Level: Initiated
    Posts: 6
    mekcas on #26379

    hi. anyone can help me?

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #26406

    Hi,
    BuddyPress does not provide this functionality.

    You put this code in your bp-custom.php and change the email addresses to be notified.

    
    
    // Add multiple emails for admin notification on new user registration.
    add_filter( 'wp_new_user_notification_email_admin',  function( $data ) {
    	$notifiable_emails = array('hello@example.com', 'abc@example.com');
    
    	$data['to'] = $data['to'] .','.join(',', $notifiable_emails);
    
    	return $data;
    } );
    
    

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    mekcas on #26410

    Can I change the array part to: role=‘officer’?
    Because sometimes officer can be add and delete so instead of “hardcoded” the emails maybe I can put the officer variable?

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #26422

    Hi,
    No, you can’t use role with the above code.

    regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved