How to bulk change notification settings for all users?

Started by Daretary, March 28, 2023, 06:14:33 AM

Previous topic - Next topic

Daretary

After switching from 1.1.21 to 2.1.3, the hosting provider began to complain that there was a huge flow of letters from the site, which, due to its mass character, is identified as spam. There are 600 messages in the queue.

I looked: all users now have this in their notifications:

We urgently need to massively redo for everyone to:

Then they will choose the right option for themselves.

Is there a SQL query or something else for this?

Daretary

Profile-Modify.php

array('select', 'msg_notify_pref', 'label' => 'before', 'opts' => array(
0 => $txt['alert_opt_msg_notify_pref_never'],
1 => $txt['alert_opt_msg_notify_pref_instant'],
2 => $txt['alert_opt_msg_notify_pref_first'],
3 => $txt['alert_opt_msg_notify_pref_daily'],
4 => $txt['alert_opt_msg_notify_pref_weekly'],
)),

All should be changed to 3.

Please give advice on how to do this in bulk.

Daretary

Found a table smf_user_alerts_prefs

There is

alert_pref
alert_value

There are entries in alert_pref
msg_notify_pref

Now we need to think about how to change alert_value only for those alert_pref where there is msg_notify_pref  :'(

Daretary

UPDATE smf_user_alerts_prefs
SET alert_value = 3
WHERE alert_pref = 'msg_notify_pref';

I made a copy of the table, I will try this query ...

Daretary

With parameter
0 there were 857 users
1 - 23375
2 - 34
3 - 2
4 - 0

Total 24268

After the request became:

1 - 0
2 - 0
3 - 24268
4 - 0

Total 24268

Thanks to all. The host provider will be pleased.   ;D

I think this thread will be useful to other people.

Advertisement: