Send user notification when activity is deleted
-
Hi,
I’m trying to create a new action which sends an email to the relevant user when his/her activity is deleted by a moderator. So far I have:
add_action( 'bp_before_activity_delete', 'pa_send_notification_email');
function pa_send_notification_email( $args ) {
// If current user deletes his/her own activity, do nothing
if ($args['user_id'] != bp_loggedin_user_id()) {
$ud = get_userdata($args['user_id']);
$to = $ud->user_email;
if (($to) && ($to != '')) {
$subject = 'Your activity has been removed';
$message = 'A moderator has removed your activity posting. If you want to know why, please contact the moderation team.';
$message .= 'Original text:';
$message .= bp_get_activity_content_body();//sends email
wp_mail($to, $subject, $message, 'content-type: text/html' );
}
}
}This works fine except for the line
$message .= bp_get_activity_content_body();
, which is attempting to include the original content of the activity (I want to include it so that the user knows exactly what was deleted).I’ve tried
$message .= bp_get_activity_content_body($args['id']);
but that didn’t work either.Does anyone know how I ought to be pulling in the activity content body text?
David
- The topic ‘Send user notification when activity is deleted’ is closed to new replies.