Replies
Hi 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!!
Hello 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!
I 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 );
“