Hi there, yes this is possible. You would need to hook on the filter bp_activity_add
and use that to send an email to the site admin. You could add this to your child thees functions.php:
add_filter( 'bp_activity_add', 'venutius_activity_admin_notify', 10, 2 );
function venutius_activity_admin_notify( $activity_array, $activity_id ) {
$site_admin_email = get_option( 'admin_email' );
$username = bp_core_get_username( $activity_array['user_id']);
$view_link = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . $activity_id;
$subject = 'New Activity Posted ';
$message = 'A new activity has been published.';
$message .= "\r\n\r\n";
$message .= 'Author' . ': ' . $username . "\r\n";
$message .= 'View the activity' . ': ' . $view_link;
$result = wp_mail( $site_admin_email, $subject, $message );
}
Thank you SO much! It works perfectly. Hopefully, it won’t be long til we have enough members on the community that it will be overwhelming to get notifications of all activity.
Hello,
Thanks for this one…
Is it possible to directly receive the “message” of the content of the activity ? instead of only link… 🙂
The content of the activity item would be $activity_array['content']
. You can see the action that Venutius was using here: https://buddypress.trac.wordpress.org/browser/tags/5.0.0/src/bp-activity/bp-activity-functions.php#L1931
So you’d just add something like
$message .= "$activity_array['content']";
to the code posted above.