Skip to:
Content
Pages
Categories
Search
Top
Bottom

Email all users of updated Forums


  • charleswaud
    Participant

    @charleswaud

    Hey there, I have looked everywhere on this forum and cannot find what I’m looking for. Apologies if this has already been answered.

    For Activity Updates, at the moment there is only the ability to receive an email notification when:
    a) A member mentions you in an update using “@[profile name]”
    b) A member replies to an update or comment you’ve posted

    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.

    Cheers!

Viewing 12 replies - 1 through 12 (of 12 total)

  • Slava Abakumov
    Moderator

    @slaffik

    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);
    } );
    

    charleswaud
    Participant

    @charleswaud

    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,


    Slava Abakumov
    Moderator

    @slaffik

    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.


    charleswaud
    Participant

    @charleswaud

    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,


    Slava Abakumov
    Moderator

    @slaffik

    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/


    charleswaud
    Participant

    @charleswaud

    Thanks Slava,

    I will try yo work this out.

    All the bests,


    charleswaud
    Participant

    @charleswaud

    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.


    Slava Abakumov
    Moderator

    @slaffik

    What have you managed to do so far? Any code written that at least partially works?


    charleswaud
    Participant

    @charleswaud

    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


    danbp
    Moderator

    @danbp

    Hi,

    did you considered this plugin ?


    charleswaud
    Participant

    @charleswaud

    Hi Dan, please could you confirm whether this plugin will automatically switch on notifications to all users for each topic posted.

    Kind regards,


    Slava Abakumov
    Moderator

    @slaffik

    @charleswaud
    You can install the plugin by yourself and try.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
Skip to toolbar