Hi Reiner,
There’s a hook you could use to fire n email:
do_action( 'bp_core_deleted_account', $user_id );
@venutius
Thank you for your help.
In which file do I have to enter this? (function.php?)
Do I then have to enter something to whom the email should be sent?
Many greetings
Reiner
Hi Reiner, I’ve got two options for you. Firstly I’ve built this into a plugin of mine – BP Messaging Control – https://wordpress.org/plugins/bp-messaging-control/
So that’s the easy option.
The alternative is to add this code to your functions.php file in your child theme folder:
function venutius_user_deletion_notify( $user_id ) {
$site_admin_email = get_option( 'admin_email' );
$userdata = get_userdata( $user_id );
$subject = __( 'User deleted', 'bp-messaging-control' ) . ': "' . $userdata->user_login . '"';
$message = __( 'A user has been deleted.', 'bp-messaging-control' );
$message .= "\r\n\r\n";
$message .= __( 'User Name', 'bp-messaging-control' ) . ': ' . $userdata->user_login . "\r\n";
$message .= __( 'User ID', 'bp-messaging-control' ) . ': ' . $user_id . "\r\n";
$result = wp_mail( $site_admin_email, $subject, $message );
}
add_action( 'bp_core_pre_delete_account', 'venutius_user_deletion_notify', 10 );
Many Thanks,
I installed the 2nd solution and it works fine.
Many greetings
Reiner