Yes, you can use a hook in a function bp_activity_add()
called the same.
/**
* Fires at the end of the execution of adding a new activity item, before returning the new activity item ID.
*
* @since 1.1.0
*
* @param array $r Array of parsed arguments for the activity item being added.
*/
do_action( 'bp_activity_add', $r );
So you should write something like this:
add_action( 'bp_activity_add', function( $arguments ) {
// Put in wp_mail() function all your params, see https://developer.wordpress.org/reference/functions/wp_mail/
wp_mail($to, $subject, $message);
} );
Hi Slava,
Thanks for the reply
just to confirm using the above custom CSS should enable all Users of the site to receive an email every time a new topic is posted within all Forums.
Kind regards,
That is not CSS, that is PHP.
And no, there is nothing to do with Forums in my code, as in your initial post you wrote this:
Is there a way to send a notification email EVERY time there is an update, regardless of whether or not they have been mentioned or have liked the post.
So my code will send an email (but you will need to write down its subject and message and get a user email to send to) on every activity added to Activity directory. If this is not what you want – you will need to filter it out properly and modify as you see fit.
I gave you the direction, not the final working solution for your seems changeable requirements.
HI Slav,
Thank you for your patience,
Can the above code be adjusted for emailing all users whenever a new topic is posted in ant Forum?
If so can you please advise where i can implement this coding in the back end of my site.
Thanks again,
Sure, you will need to filter out the $arguments
variable in my code for the required by you activity_type
.
You can put the resulting code into a separate custom plugin or in https://codex.buddypress.org/themes/bp-custom-php/
Thanks Slava,
I will try yo work this out.
All the bests,
Hello Slava,
i’ve had no joy actioning the above i’m afraid – perhaps you could provide me with a bit more guidance e.g were i place this PHP and the best way to modify for my purpose.
This would be much appreciated.
Thanks very much.
What have you managed to do so far? Any code written that at least partially works?
Thanks for the reply,
I’m afraid not – just threw the website off and had revert to a backup of the site.
Looking to start afresh, yet cant find much help out there regarding my issue.
Issue – I would like to set up an email notification that will send an email to every single member regardless of group/Forum etc informing them of a new post/comment.
So basically whenever there is activity amongst members within Buddy press I would like all members to know about it.
All the best
Hi,
did you considered this plugin ?
Hi Dan, please could you confirm whether this plugin will automatically switch on notifications to all users for each topic posted.
Kind regards,
@charleswaud
You can install the plugin by yourself and try.