Skip to:
Content
Pages
Categories
Search
Top
Bottom

Notification emails after import


  • reedy
    Participant

    @reedy

    I recently imported a phpBB forum to bbpress. All went well.

    The only issue is buddypress is now sending out notification emails for all mentions from the beginning of time. My forum is about 7 years old and has around half a million posts.

    Thats a lot of notification emails, and a lot of potential spam.

    How can I fix this? I still want new notifications for mentions going out – just not those from before the import. I’m happy to run a mysql query that will mark all notifications emails as being already sent out for each member through to now – if there is a way to do that????!!!

Viewing 25 replies - 1 through 25 (of 28 total)

  • shanebp
    Moderator

    @shanebp

    Look at this table {your prefix}_bp_notifications and the is_new field.

    Try running a query that sets that field in each row to 0, or maybe each row with a specific component_name.


    reedy
    Participant

    @reedy

    I am not confident with coming up with my own query. Can you offer a bit more guidance? By that, I mean paste the entire query I should run 😉


    reedy
    Participant

    @reedy

    @shanebp – Wouldn’t your suggestion just turn off notification altogether? I don’t want to do that – I just want to stop members getting notifications of @mentions from years ago (or, prior to the import at least).

    Is there any way to purge notifications emails for mentions made before a certain date from the database? For the past few days, my server has been sending out hundreds of these notification emails with activity mentions that took place years ago. As a result, I’m getting a lot of (warranted) grief.


    shanebp
    Moderator

    @shanebp

    Wouldn’t your suggestion just turn off notification altogether?

    No, it would ( I think, but have not tested ) set all existing notifications > is_new to false.

    Providing you with an untested mysql query that you will run on a production site is not something I am willing to do. If you have phpmyadmin installed on your host, try running queries via that interface. Start with SELECT. When you’re satisfied that it is returning the correct rows, then change it to DELETE. But make a backup of your database first!


    Henry Wright
    Moderator

    @henrywright

    @shanebp’s suggestion will mark web notifications as “read”. Regarding email notifications, if they’ve already been triggered and are sitting in a mail queue waiting to be sent, I suggest you contact your host. Hopefully they can delete the whole batch for you directly.


    reedy
    Participant

    @reedy

    @henrywright – My web host said there were only 164 messages in the queue last night when they looked. However, I know for a fact more than that are going out and that they’re going out every day for mentions that happened years ago. Does wordpress process this in batches or as a cron?


    Henry Wright
    Moderator

    @henrywright

    BP uses the wp_mail() function to send email. Ref https://developer.wordpress.org/reference/functions/wp_mail/


    reedy
    Participant

    @reedy

    OK, so about five hours ago I ran the following query:

    UPDATE bp_notifications SET is_new=0 WHERE is_new=1

    This worked as intended – the is_new field was updated to 0 in all rows of the bp_notifications table.

    However, I just finished speaking to my host and they said:

    A mail was generated as recently as 5 minutes ago with a notification for content dating back to 2007 (I only know this because it’s currently in the mailserver’s queue for delivery).

    There is not (and have never really been when I have logged on) a substantive amount of messages in the mailserver’s queue to speak of – if there is a queue still, it’s in your application’s database/code somewhere – they only seem to be dribbling out a few at a time.

    Does anyone have any other ideas?


    Henry Wright
    Moderator

    @henrywright

    if there is a queue still, it’s in your application’s database/code somewhere

    BuddyPress doesn’t queue up emails in this way. You should deactivate all custom code you’re running, that includes any import scripts or custom libraries, plugins, code snippets in functions.php or bp-custom.php and then check again if mail is being sent out.


    reedy
    Participant

    @reedy

    I deactivated all other plugins and code snippets in functions.php (none of which are related to buddypress) and users are still getting spammed with these emails. How on earth can I stop this from happening? I am getting so many complaints I just don’t know how to handle this.

    Maybe I just need to comment out the notification emails and just remove the functionality entirely? This is driving me (and thousands of people) crazy.

    Furthermore, I am concerned that I’m going to get into trouble under the UK’s anti-spam laws.


    Henry Wright
    Moderator

    @henrywright

    If you’re running vanilla WordPress, with BuddyPress as the only plugin installed and you’re sure you have no custom code in place, it may mean your install has been compromised. You should check to be sure this isn’t the case.

    Just a thought, have you tried using a standard theme such as Twenty Fifteen?


    Henry Wright
    Moderator

    @henrywright

    In the mean time you could ask your host to deactivate your mail server, until you find a fix?


    reedy
    Participant

    @reedy

    I very much doubt my install has been compromised. In fact, searching through the buddypress support forum it seems this is an issue that crops up after imports – so I believe there is probably something in the core code doing this.

    A couple of examples:

    https://buddypress.org/support/topic/post-migration-constant-user-email-notifications-for-mentions/ @zane

    https://buddypress.org/support/topic/mass-notifications-of-old-mentions/ @halo-diehard

    Disabling my mail server is not a practical solution. For now I will just have to block all email notifications for mentions until (hopefully) a solution is found.

    Pssst @netweb – are you still around?


    Henry Wright
    Moderator

    @henrywright

    I very much doubt my install has been compromised. In fact, searching through the buddypress support forum it seems this is an issue that crops up after imports

    That suggests your import script is the issue. Which script are you using?


    reedy
    Participant

    @reedy

    I used the bbpress importer for phpBB:

    phpBB

    The script only runs once and after everything is imported it is not used.


    shanebp
    Moderator

    @shanebp

    Because emails are being sent, a lot of notifications were created too, correct?
    Are the notifications being created in ‘batches’ ala the emails?
    And were any activity entries created?

    afaik – BuddyPress only handles @ mentions in the context of activity, hence:
    add_filter( 'bp_activity_do_mentions', '__return_false' );

    If true, then bbPress is parsing @ mentions in forum posts and creating BP notifications which result in emails being sent.

    I don’t have a solution – just trying to outline the sequence.
    Very curious to know why, given that the email server queue isn’t massive, there seems to be a throttle on the process.

    Have you tried asking bbPress about this?
    You may need to open a ticket to get a useful response. If you do, please share it here.


    reedy
    Participant

    @reedy

    OK, just so we’re on the same page I’ll give the URIs as I respond.

    Having looked into my notifications feed here:

    /members/member-name/notifications/

    I see that notifications were indeed coming in in ‘batches’, too.

    For example:

    All refer to pre-import mentions.

    HOWEVER, no notifications for pre-import activity appear there from the time I ran the below mySQL query yesterday:

    UPDATE bp_notifications SET is_new=0 WHERE is_new=1

    So that seems to have had some effect (yet emails continued to go out).

    As for activity entries being created, if I go to:

    /members/member-name/activity/

    … it contains all activity from the start of time (post-import and pre-import activity).

    bbpress told me this is a buddypress issue since buddypress generates the @mention email notifications.

    A couple of hours ago I added this to my functions.php file:

    //buddypress stop mention emails //
    remove_action( 'bp_activity_sent_mention_email', 'bp_activity_at_message_notification', 10, 5 );
    //End buddypress stop mention emails //

    Hopefully that will stop new emails from going out. Not the ideal solution, though as it also blocks mentions for anything post-import, too (I believe).


    shanebp
    Moderator

    @shanebp

    Does the notification table in the database contain POST-IMPORT entries ?
    If so, can you tell if those entries relate to the importing?


    reedy
    Participant

    @reedy

    bp_notifications is still generating notifications on pre-import mentions.

    When I sort bp_notifications by date_notified I see:

    When I reference the item_id back to the bp_activity table, the IDs for date_notified as you can see in the screenshot above relate to very old pre-import activity.

    When I sort bp_notifications by item_id I see:

    You can see from the above screenshot all the pre-import mention notifications going out (look at the jump in item_id between forums and activity).

    Post-import new reply notifications are working fine.


    reedy
    Participant

    @reedy

    My host said emails are STILL being sent out.

    Can anyone suggest an interim solution (other than switching off my mailserver completely) to stop these emails going out?

    Evidently placing the code below in functions.php had no effect:

    //buddypress stop mention emails //
    remove_action( 'bp_activity_sent_mention_email', 'bp_activity_at_message_notification', 10, 5 );
    //End buddypress stop mention emails //

    shanebp
    Moderator

    @shanebp

    bp_notifications is still generating notifications on pre-import mentions.

    That is so bizarre… I have no idea why.
    Can you have your host check for processes that have been running for a looong time or using a lot of memory and kill them?

    Your db screenshots show some rows that look strange to me – the last 3 rows of the last graphic seem suspicious.

    Personally, I would wipe the install and start over.
    Or at least deactivate both BP and bbPress.
    If emails keep arriving, then it’s WP or your server.


    reedy
    Participant

    @reedy

    I’ll ask my host.

    In the meantime, where are a member’s preferences stored when they choose email settings under:

    “A member mentions you in an update using @…”

    Maybe I just can run a query and set them all to no for the time being.


    reedy
    Participant

    @reedy

    A response from my host:

    Nope; there’s no background processes. If there were, I’d expect to be seeing a lot higher rate of messages – they seem to more or less be coming out every time a page is loaded (some people refer to the behaviour as “poor man’s cron”)


    Henry Wright
    Moderator

    @henrywright

    @reedy to my knowledge BuddyPress doesn’t implement any cron jobs, especially ones that send email.

    they seem to more or less be coming out every time a page is loaded

    This indicates something is hooked to init, or bp_loaded etc. But that would almost certainly be custom code because nothing in BuddyPress or bbPress would hook to those events and send email.

    Have you fully disabled the importer script?


    reedy
    Participant

    @reedy

    How do I disable the importer script? I used the official bbpress importer script found in:

    Wp-Admin>Tools>Forums>Import Forums

    As far as I know, once it’s done importing then it’s done importing.

Viewing 25 replies - 1 through 25 (of 28 total)
  • The topic ‘Notification emails after import’ is closed to new replies.
Skip to toolbar