PDA

View Full Version : SQL Query to turn off admin email for specific usergroup


Magle
10-05-2013, 10:05 AM
Hello,

As I can't seem to find a vb 4.x mod that allows turning off Admin Emails for a specific usergroup, I would like to ask if anyone knows what SQL query I could use for that.

I know there is an automatic pre-made query "No - Receive Admin Emails", but that turns it off for all users. I would like to only turn it off for a specific group.

Thank you in advance for any help

-Frederik

ozzy47
10-05-2013, 10:21 AM
Run this query.

UPDATE user SET options = options - 16 WHERE options & 16 AND usergroupid = X

Change the X to the usergroup id that you want to do that to.

Magle
10-05-2013, 11:10 AM
Thank you very much!!

ozzy47
10-05-2013, 11:25 AM
Not a problem, glad to help. :)

Magle
10-05-2013, 12:42 PM
:)

I hope you don't mind me asking another question. What variable would I use to delete subscriptions for all members of a usergroup?

The reason I'm asking these questions, is that I have many old inactive members, and the forum keeps sending them birthday greetings and emails with updates of threads they have subscribed to, but many of these emails bounce back (and I fear they are flagged as spam). So, I have installed This mod (https://vborg.vbsupport.ru/showthread.php?t=231874), which enables me to put them all in one group, so I can delete all their subscriptions and turn off admin emails (if people hasn't visited for more than 2 years, I see no reason to keep sending them updates and birthday greetings).

ozzy47
10-05-2013, 01:08 PM
This should do the trick.

DELETE `subscribethread` FROM `subscribethread`
LEFT JOIN `user` ON `subscribethread`.`userid` = `user`.`userid`
WHERE `subscribethread`.`emailupdate` <> '0' AND `user`.`usergroupid` = 'X'Change X to the usergroup ID

That query will delete all the threads users in the usergroup X are subscribed to.

Magle
10-05-2013, 01:20 PM
Awesome, thank you! I just tested it on a test user/usergroup and it worked like a charm! :)

Thanks again!

ozzy47
10-05-2013, 01:33 PM
Not a problem, glad it worked how you wanted. :)