Hello there!
I’d like to notificate everything’s happening in my groups and I found there was a code to notify by email with BuddyPress Group Activities Notifier, but isn’t working for me…
I’ve tried BuddyPress BuddyPress Group Email Subscription but it don’t fix in my idea of the webpage.
Can you help me with notificating the activity of the group algo by email?
Thanks!
Hi,
Welcome to BuddyDev forums.Please install a mail logging plugin such as mail catcher
https://wordpress.org/plugins/wp-mail-catcher/Please let me know if it show the mails or not?
Regards
BrajeshI saw there is a code to send emails to everyone about the group activity but isn’t working in mi web.
The text was:
“Notify by email:-
This plugin does not support notification by email out of the box. The email notifications are resource intensive and based on the number of members of group, may cause timeouts. If you still believe that you want the email notification, you can put the following code in your bp-custom.phpPHP
function buddydev_mail_on_new_group_activity( $user_ids, $args ) {if ( empty($user_ids ) ) {
return ;
}
//do a bulk query
$users = get_users( array( ‘include’ => $user_ids ) );$group = new BP_Groups_Group( $args[‘group_id’] );
$loggedin_user_display_name = bp_get_loggedin_user_fullname();$activity = new BP_Activity_Activity( $args[‘activity_id’] );
$activity_content = $activity->content;
$activity_permalink = bp_activity_get_permalink( $activity->id, $activity );$subject = sprintf( ‘%1$s posted to %2$s’, $loggedin_user_display_name, $group->name );
$message = <<<‘MAINCONTENT’
Hi %1$s,
%2$s posted…%3$s
Link: %4$s
MAINCONTENT;foreach ( $users as $user ) {
$message = sprintf( $message, $user->displayname, $loggedin_user_display_name, $activity_content, $activity_permalink );
wp_mail( $user->user_email, $subject, $message );
}
}
add_action( ‘bp_group_activities_notify_members’, ‘buddydev_mail_on_new_group_activity’, 10, );
function buddydev_mail_on_new_group_activity( $user_ids, $args ) {if ( empty($user_ids ) ) {
return ;
}
//do a bulk query
$users = get_users( array( ‘include’ => $user_ids ) );$group = new BP_Groups_Group( $args[‘group_id’] );
$loggedin_user_display_name = bp_get_loggedin_user_fullname();$activity = new BP_Activity_Activity( $args[‘activity_id’] );
$activity_content = $activity->content;
$activity_permalink = bp_activity_get_permalink( $activity->id, $activity );$subject = sprintf( ‘%1$s posted to %2$s’, $loggedin_user_display_name, $group->name );
$message = <<<‘MAINCONTENT’
Hi %1$s,
%2$s posted…%3$s
Link: %4$s
MAINCONTENT;foreach ( $users as $user ) {
$message = sprintf( $message, $user->displayname, $loggedin_user_display_name, $activity_content, $activity_permalink );
wp_mail( $user->user_email, $subject, $message );
}
}
add_action( ‘bp_group_activities_notify_members’, ‘buddydev_mail_on_new_group_activity’, 10, 2 );
“Hi,
Thank you for the reply.Where have you put the code(which file).
Please share the complete code from the file on pastebin.com and link me.
Thank you
BrajeshHello Brajesh,
This is the code I’m trying to use. I’ve created a bp-custom folder and inside I’ve created a file named bp-custom.
I don’t know if I’m doing well, please tell me.
So thankfull!
Hello Arisanz,
Please take the following resource to get complete knowledge for bp-custom.php file.
https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/
Give it a shot and let me know if it works or not.
Regards
Ravi- This reply was modified 3 years, 9 months ago by Ravi.
Hi,
Please create a file as suggested by Ravi above.
Your current location for bp-custom is incorrect. The file bp-custom.php should go into the wp-content/plugins directory.Regards
BrajeshHi guys thank you!
Something wrong it’s happening when I create the file bp-custom.php
The content of the code is appearing before the header of my page. Please, I need to know if the text I’m writing in this file is correct maybe I’m not writing the correct code.
Thanks for your help!!
You must be logged in to reply to this topic.