Setting default board alerts for a membergroup

Started by nc3man, February 27, 2023, 01:28:57 PM

Previous topic - Next topic

nc3man

Our SMF forum is used by our bike club for member alerts and notifications. We have an integration with our membership software (aMember Pro) so that all active members are added to a special membergroup - these are the only folks who can post. We would also like to have everyone in this membergroup receive emails and alerts on our main board by default. I am looking for a way to simply do this. Ideally, under this membergroup settings, I would just like to select boards for which every person in the membergroup would receive emails and alerts by default for new topics in the board. They would, of course, have the option to turn it off. Our members also agree, when signing up, to receive all communications from the club, so this would not violate any anti-spam policy, plus our message traffic is rather light.

Kindred

no....    there is no way to do this through any standard admin tool because having an admin set notifications for members would be illegal in many locations.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nc3man

I do understand the illegal part due to GDPR (note the warning for the admin setting default notifications). I suppose I could just do this with SQL and maybe the best thing to do would be to update our aMember Pro integration which drops folks into our membergroup, setting their default board alert setting at the same time. Since they have to agree to our notification policy when they signup and renew each year, we would not be doing anything illegal in my mind, especially since they can turn it off at any time.

nc3man

So I did this with an SQL query and I hate to touch the DB directly. I created a list of id_member's who currently had no watch on our main board (id_board=1). For each $id_member in the list, I just executed
INSERT INTO smf_log_notify(id_member, id_topic, id_board, sent) VALUES ($id_member,  0, 1, 0);It appeared to work just fine. I could see no immediate side effects. Is that a good assumption?

live627

Yes, that's the only thing you need to do to add a notification subscription.

nc3man

Quote from: live627 on February 27, 2023, 10:26:17 PMYes, that's the only thing you need to do to add a notification subscription.
phew, thanks  8)

nc3man

I had marked this solved, but something happened that I don't understand. What should the setting of the "sent" field be before and after a new topic is posted? I ran my SQL query to ensure all 196 users in a membergroup to be notified on id_board=1 and set sent=0 for all 196. After the first new topic it looked like the mail queue properly filled up and it was cleared within 5 minutes (we have a cron job that executes /path/smf/cron.php every 5 minutes). We use a 3rd part mailer for all our bulk emails on our website and so our Mail Type is SMTP-STARTTLS. I checked with our mail service and noticed that 176 emails had been delivered. I also checked the database and now see sent=1 for the 176 who received emails but sent=0 for the 20 who did not. Coincidentally(?) in our Mail settings, I also set Maximum emails to send per minute to 20 and Maximum amount of emails to send per page load also to 20. It is odd that all but 20 actually received emails. Also, if the sent flag is set to 1, will the next new topic be sent, or does that need to be reset to 0 as I had initially set all 196 in the membergroup? I was actually hoping to set both of those numbers to 500 or even larger as our mail service doesn't need to be throttled. I also do not understand what is meant by "page load" which sounds more likely that is the issue.

nc3man

#7
Quote from: nc3man on March 02, 2023, 03:21:37 PM...Also, if the sent flag is set to 1, will the next new topic be sent, or does that need to be reset to 0 as I had initially set all 196 in the membergroup?...
Ignoring the failed delivery for a moment and focusing on the sent flag state, I found a 2018 post by @TomasM that focused on this statement received in a board new topic notification.
QuoteMore topics may be posted, but you won't receive more email notifications for this board until you return to the board and read some of them.
For our use case of very low volume and people ignoring a post if the subject is irrelevant for them, that is unwanted behavior. Since most users in our case set frequency of notification to Immediate, they would like it straight away. Reading through that long 2018 thread, it sounded like the sent state gets set from 1 back to 0 only after the user visits the board (maybe has to read the topic notified) and it looks like that might have to be done at least twice before notifications start up again.

The statement "read some of them" is undefined and gives no clue to the person notified how they can get back on board (pun intended). I can understand for huge forums with huge activity that the behavior described would be desired, but our use case is maybe 10 posts/replies a week, maybe only 4-5 new topics, so a couple of emails per week is what a person would get and they could easily decide whether to take the time to visit the forum.

In that 2018 post, this behavior was alternately referred to "as designed" or "a bug." Has this ever been resolved? For this to be useful in our case, the desired behavior could be set in the general Notifications setting for the Forum with just 2 options: (1) current default, historical SMF behavior; (2) Immediate means immediate and dropping the note in the alert to visit the topic to keep getting alerts.  Also, code snippets were shared to evidently get the behavior that both @TomasM and I desire. I'm not afraid of customizing code to make this work as desired.

nc3man

Looking at the solution for immediate board new topic notification in the 2018 post by @TomasM, I think I have a simple code hack that works for our use case in SMF 2.1.2, only affecting a few lines in CreatePost-Notify.php

First, just comment out lines 504-5 because all our users not only want an alert for every new topic on a watched board, but we have time constraints as a post is sometimes a last-minute event cancellation.
// 6. We already sent one and the watching member doesn't want more.
//khr: if ($frequency == self::FREQUENCY_FIRST_UNREAD_MSG && $member_data['sent'])
//khr: continue;
Then to avoid the message asking to go to the forum to "read some more", change line 540 from
$message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards';
to simply
$message_type = 'notify_boards';

nc3man

#9
Quote from: nc3man on March 02, 2023, 08:42:53 PMLooking at the solution for immediate board new topic notification in the 2018 post by @TomasM, I think I have a simple code hack that works for our use case in SMF 2.1.2, only affecting a few lines in CreatePost-Notify.php..
I discovered that the immediate behavior for new topics on a watched board actually works fine without commenting out lines 504-505.  We get immediate email notifications on a watched board no matter how many new topics pile up without the watcher having to physically visit the forum.

However, I needed to change line 540 as suggested to finally remove the utterly confusing
More topics may be posted, but you won't receive more email notifications for this board until you return to the board and read some of them.
When we upgrade to 2.1.4 (2.1.3 had an actual notification bug which was just solved - closed on github #7680 as completed via #7691), I will double check that message on 2.1.4. Hopefully @sbulen and/or @Sesquipedalian might ensure that for 2.1.4.

As a side not, by looking at the smf_log_notify table directly, I verified that after the email is sent, the "sent" flag is set to 1, but once the user goes to the forum to read a new topic, "sent" is set to 0 immediately.

Kindred

yes, that flag behavior is correct.

As soon as they visit the board, they can/will be notified of the first new post AFTER that visit.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: