Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Two Email Notifications for new comment.

2

Comments

  • SheilaSheila ✭✭

    @UnderDog, I totally understand your point. I went thru these same posts going on about configurations, and since I was not sure, which parts to are really relevant to the report, decided it's best to link the whole thread.

    So don't shoot the messenger ;) Was just trying to be helpful. With giving more details it's back to @peregrine & @pnommensen .

  • pretty much If you set Advanced notifications for a user and check send mail for new comment and send mail for new discussions, it will send e-mails, regardless what the other user preferences for mail are. So if a user, check send mail on bookmarked discussions, or any of the other preferences, it doesn't check first to see if the user also checked "send mail for new comment and send mail for new discussions". Thus two e-mail (or so it seems) are sent. So, it seems there needs to be an overtide that looks to see if "send mail for new comment and send mail for new discussions are checked" and ignore the other email sending preferences.

    if you want sheila you can refer them back to this comment.

    But there needs to be corroboration, that the above is in fact true. I don't have a live server, I tried with the fakemail server program (see my other post on mail testing) and it seemed for me the above was true.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • But there needs to be corroboration, that the above is in fact true.

    I can confirm that this is the case.

  • so did the fixes I suggested solve your problem @pnommensen

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • If I change the values to 0 below nothing gets sent.

    Preference.Email.NewDiscussion
    Preference.Email.NewComment

    I guess it also doesn't solve the issue because if people go to edit their preference and select yes for Notify me when people start new discussions and Notify me when people comment on a discussion it changes the values back to 1 which will send out 2 emails. I haven't tried disabling advanced notifications for users and setting these values to 1. Would that perhaps work?

  • It's getting a bit exasperating....

    Your goal was to send out emails for new discussions and new comments for all users correct.

    in that case all users need  (**it is Preferences not Preference** (my typo).
    Preferences.Email.NewDiscussion   
    Preferences.Email.NewComment   
    with values set to 1.   
    
        turn off ability to set advanced notifications and then nobody can modify it.
        tell all users they will get email for all comments and discussions.
    
        If they don't want duplicate e-mail, then don't check any boxes that say e-mail in their preferences that relate to discussions , comments.
    
        it's really that simple.
    
        You will need to ensure all user ids have 
        Preferences.Email.NewDiscussion   
        Preferences.Email.NewComment   
        with values set to 1.   
    
        if you add users you have to insert the values in usermeta table.  - no ifs and or buts.
        you could add a bunch of userids 
    
        lets say you have 50 users currently, you could preset the next 50 users by insertion into the usermetatable.  That way when a new user applies they will already be set up in the usermetatable.
    
        add userid  51 into the usermeta table with
        Preferences.Email.NewDiscussion   
        Preferences.Email.NewComment   
        with values set to 1.   
    
    
        add userid  52 into the usermeta table with
        Preferences.Email.NewDiscussion   
        Preferences.Email.NewComment   
        with values set to 1.   
    
        ......
    
        add userid  100 into the usermeta table with
        Preferences.Email.NewDiscussion   
        Preferences.Email.NewComment   
        with values set to 1. 
    

    if you don't want users to automatically to get emails automatically for new discussions and new comments, tell them set there own preferences (for bookmarks, etc.. and make sure that advanced notifications is turned off in dashboard (so they can't change the all Discussions and All Comments).

    then remove the
    Preferences.Email.NewDiscussion
    Preferences.Email.NewComment

    for every user from the table (if you want things to process faster)

    ....

    or if you prefer to process things slower and require a lookup modify the values to zero.
    and there will have to be a lookup.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • also set these to false and add to your config.php, if you want the setting for anything besides if Your goal was to send out emails for new discussions and new comments for all users correct. any new users added will automatically have boxes unchecked.
    it will not change preferences for old users.

     $Configuration['Preferences']['Email']['ActivityComment'] = TRUE; Notify me when people reply to my wall comments.
    
        $Configuration['Preferences']['Email']['AddedToConversation'] = TRUE; Notify me when I am added to private conversations.
    
        $Configuration['Preferences']['Email']['BookmarkComment'] = TRUE; Notify me when people comment on my bookmarked discussions.
    
        $Configuration['Preferences']['Email']['CommentMention'] = TRUE; Notify me when people mention me in comments.
    
        $Configuration['Preferences']['Email']['ConversationMessage'] = TRUE; Notify me of private messages.
    
        $Configuration['Preferences']['Email']['DiscussionComment'] = TRUE; Notify me when people comment on my discussions.
    
        $Configuration['Preferences']['Email']['DiscussionMention'] = TRUE; Notify me when people mention me in discussion titles.
    
        $Configuration['Preferences']['Email']['WallComment'] = TRUE; Notify me when people write on my wall.
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Sorry to resurrect an old thread but I've been 3 days trying to figure this one out, I haven't gotten anywhere, and this thread is the only one that seems to accurately describes my problem so I figured if any progress was made it might help other users in the future.

    Following the steps above do not resolve the issue, in fact they are the exact steps needed to replicate the problem for me. There is one further thing that I've noticed though - even if every email preference is set to false I only need to turn on Preferences.Email.NewDiscussion to get double emails for both every new discussion as well as every new comment. Preferences.Email.NewComment does not appear to do anything at all, as when it is turned on on it's own I get no notifications at all for new comments or new discussions.

    According to https://github.com/vanillaforums/Garden/issues/1395 this behaviour seems to be a known bug, but I'd rather not install Alpha software to try and overcome it. If possible I'd like to get a fix for the current release, even if it means delving into the code and patching it myself. The only problem is I'm not a programmer and I don't know where to even begin looking.

    Any help would be greatly appreciated, and I'm happy to provide any information required. If this kind of thread bumping is considered bad form then please accept my apologies and mods can feel free to delete the post. I'll happily start a new thread instead if that's considered more useful.

  • I too am having this problem and struggling to glean the correct workaround from the oddly aggressive messages left by "Supreme Commander" @peregrine.

    Is there a simple workaround? I have tried several combinations of user preferences, and if I go delving in PHP or file-based config I want to be confident that I don't introduce other undesired behaviour.

  • peregrineperegrine MVP
    edited November 2012

    @chrisbeach stated in a passive-aggressive snipe:

    Is there a simple workaround?

    oddly as it may seem, that would be a "NO" . Sorry, I meant to say "no". Unless it is fixed in v2.1

    and if I go delving in PHP or file-based config I want to be confident that I don't introduce other undesired behaviour.

    Rhetorical question can one ever be 100% confident? But then again you can also be confident, but wrong. Its all a matter of semantics and skill, with a bit of luck added.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • cvr3cvr3 New
    edited January 2013

    I have a dirty fix for the above problem!. My apologies, if it creates other problems.

    You may comment out line number 735 of the file

     "applications/vanilla/models/class.commentmodel.php"
    

    The content of the line is the following.

      $ActivityModel->SendNotificationQueue();
    

    To comment out the line (for non-programmers)
    please prefix the line with // so that the line becomes as follows.

     //$ActivityModel->SendNotificationQueue();
    

    Please try the latest version of vanilla to see it has already been fixed by the developers.

  • Many thanks cvr3 I'll give that a try some time today.

  • Did you try my fix? Has it caused any other problems?

  • yes - I'd love to know if this worked out, before trying myself.. anyone?

  • I am also having this problem. If anyone has any suggestions of a way to fix this I would be very grateful.

  • I am also having this problem and would be grateful for some guidance!

  • edited April 2013

    I realized that checking notification for every new comment adds something related to the Preferences cell in the User table, in addition to the UserMeta table.

     "Email.NewComment";s:1:"1";
    

    When unchecking the user setting, the line in UserMeta is deleted, but the preference in the User table remains. I don't understand the preferences syntax in the db.

    I'm using 2.0.18.8 and have the same problem with double email notifications.

  • @cvr3 Almost 4 months later but I finally got to test that fix. So far it seems to work fine, I started a new thread as a test user, made some comments, did the same as my own user and only got one notification for each one. I've also had a couple of other users comment that it's working for them too, so fingers crossed it's gone for good and nothing else is broken as a result :)

    I'll post here if I have to revert back for any reason, but hopefully that'll sort it until 2.1 gets released and fixes it for good.

  • Quick fix, Disable QueueNotification function in this file.
    ./applications/dashboard/models/class.activitymodel.php

    This stopped double emails for me.

    public function QueueNotification($ActivityID, $Story = '', $Position = 'last', $Force = FALSE) {

    return;

    ....

    }

    Can some developer from vanillaforum check it?

    Thanks

  • dnearydneary New
    edited June 2013

    Re-bumping this thread. I went digging, and diagnosed this to application/vanilla/model/class.commentmodel.php line 765: The commentmodel is adding notifications for everyone with the "NewDiscussion.Email" preference set. This has been fixed in the 2.1 branch, but not the 2.0 branch. The quick fix is below:

    [dneary@leitrim models]$ git diff 8ec955c~..8ec955c
    diff --git a/vanilla/applications/vanilla/models/class.commentmodel.php b/vanilla/applications/vanilla/models/class.commentmodel.php
    index f3e59e2..ec2d902 100755
    --- a/vanilla/applications/vanilla/models/class.commentmodel.php
    +++ b/vanilla/applications/vanilla/models/class.commentmodel.php
    @@ -782,7 +782,7 @@ class CommentModel extends VanillaModel {
         */
        public function RecordAdvancedNotications($ActivityModel, $Discussion, $Comment, &$NotifiedUsers) {
           // Grab all of the users that need to be notified.
    -      $Data = $this->SQL->GetWhere('UserMeta', array('Name' => 'Preferences.Email.NewDiscussion'))->ResultArray();
    +      $Data = $this->SQL->GetWhere('UserMeta', array('Name' => 'Preferences.Email.NewComment'))->ResultArray();
           
           // Grab all of their follow/unfollow preferences.
           $UserIDs = ConsolidateArrayValuesByKey($Data, 'UserID');
    

    But this will still have issues related to popup notifications, I think. 2.1 fixes this correctly, and looks back-portable.

    Cheers,
    Dave.

Sign In or Register to comment.