View Full Version : [fixed] Stop banned members getting emails from subscribed threads automatically
Erwin
Thu 12th Sep '02, 12:14am
I'm not sure if you would consider this a bug in vB 2.2.x, but I do.
As some of you may have come to realize, one of the shortcomings of vB is that after we have banned a member, that member still receives email notification, even when we have banned the member from viewing the forum or any threads.
Obviously a banned member cannot access his or her user control panel to unsubscribe to threads or switch off email notification. We as admins cannot access the member's user control panel to unsubscribe him from threads since we don't have his password, and we cannot do it from the Admin CP.
We can run a db query to unsubscribe the member manually:
DELETE FROM subscribethread WHERE userid=XX
Where XX is the userid of the member. It's very easy to add this to the Admin CP by the way. However, this is cumbersome, as the process is not automated. And once you unban the member, he has to remember to subscribe himself to the right threads again.
I wanted to make this automatic. With this mini-hack, once you ban a member (or make a member unregistered, awaiting email confirmation or a COPPA member), his email notification stops automatically. When you unban the member (or make the member registered etc.), his email notification automatically restarts again. No need to manually run that db query.
It's easy to install and is a matter of ADDING ONE line in functions.php
In functions.php:
Find:
AND user.userid<>'$userid'
BELOW IT ADD:
AND user.usergroupid NOT IN (1,3,4,8)
That's it! So when you ban a member or make them unregistered, or awaiting email confirmation, they will stop receiving email notifications. No more emails from irate banned members! :)
eva2000
Tue 17th Sep '02, 8:02pm
hmmm i thought this was already fixed in latest vB versions.. what version are you using ?
Scott MacVicar
Tue 17th Sep '02, 9:09pm
Just because a user is banned doesnt mean they shouldn't get emails, and you shouldn't be able to set a user to Unregistered / Not Logged In, that implies a guest.
and the banned usergroup changes from vB to vB as its not set as default.
I'll move it to the bugs forum for now and have a think about it.
Erwin
Tue 17th Sep '02, 10:48pm
Originally posted by PPN
Just because a user is banned doesnt mean they shouldn't get emails, and you shouldn't be able to set a user to Unregistered / Not Logged In, that implies a guest.
A banned user who has been banned from reading threads or viewing the forums should also not continue to receive subscribed threads, since the banned user cannot go and unsubscribe himself. What he or she ends up doing is spam-blocking the email domain, which is overall bad for the site (has happened to my site already). The unsubscription should be automatic.
My fix is not meant to be definitive - it's just a quick way of circumventing this issue until a real fix happens (hopefully in vB3).
Erwin
Tue 17th Sep '02, 10:57pm
Originally posted by eva2000
hmmm i thought this was already fixed in latest vB versions.. what version are you using ?
This has always been the case in 2.2.x - I use the latest 2.2.7
Scott MacVicar
Wed 18th Sep '02, 6:41am
Try the following, it wont send it to people who can't view the board and hence can't unsubscrib.e
$useremails=$DB_site->query("SELECT user.*
FROM subscribethread,user
WHERE subscribethread.threadid='$threadid'
AND subscribethread.userid=user.userid
AND user.userid<>'$userid'
AND user.lastactivity>'$lastposttime[dateline]'
");
becomes
$useremails=$DB_site->query("SELECT user.*
FROM subscribethread,user,usergroup
WHERE subscribethread.threadid='$threadid'
AND subscribethread.userid=user.userid
AND user.usergroupid=usergroup.usergroupid AND user.userid<>'$userid'
AND user.lastactivity>'$lastposttime[dateline]'
AND usergroup.canview = 1
");
Erwin
Wed 18th Sep '02, 8:55am
But what about members who have subscribed to threads, then change their email addresses to one that doesn't work, so they become a "awaiting confirmation email" user permanently - they can't access the site, and although they won't be receiving the subscribed emails, the mail server will keep trying to send mail to them, and clogging up the mail server. So you still have to "unsubscribe" these people.
Also, I have a couple of usergroups of banned members, one of which CAN view the forum, but is unable to post or access the control panel to unsubscribe - these people will still get subscribed emails using you fix.
Best to have a system that deals with usergroups rather than if they can view the forum as a whole.
Paul
Wed 18th Sep '02, 10:59am
A word of caution:
PPN's suggested fix has a misplaced semi-colon:
AND usergroup.canview = 1;
");
Use the following instead:
$useremails=$DB_site->query("SELECT user.*
FROM subscribethread,user,usergroup
WHERE subscribethread.threadid='$threadid'
AND subscribethread.userid=user.userid
AND user.usergroupid=usergroup.usergroupid AND user.userid<>'$userid'
AND user.lastactivity>'$lastposttime[dateline]'
AND usergroup.canview = 1
");
As an aside, rather than use canview, is there a way to check if they're banned via the database? It might require an extra query.
Paul
Scott MacVicar
Wed 18th Sep '02, 6:45pm
if they can access the site they can unsubscribe or set the correct email, if they cant access the site it wont.
Loveshack, you should add a semi colon at the end of a query to indicate that its finished, as you can run more than one query at a time.
Paul
Wed 18th Sep '02, 6:52pm
Originally posted by PPN
Loveshack, you should add a semi colon at the end of a query to indicate that its finished, as you can run more than one query at a time.
Well, with the semi-colon in place, I got an inbox full of vBulletin database errors. Taking it out fixed the problem. ;)
Perhaps there's something I'm missing?
Paul
DVD Plaza
Wed 18th Sep '02, 7:08pm
I used to get extreme levels of abusive e-mails when our newsletter went to banned members, that was corrected long ago but from that I can perfectly understand why it is totally unacceptable that someone who is outright banned (rather than suspended, etc) should not receive ANY e-mails.
I'm amazed I've never received abuse over that matter, I guess none of my banned members were subscribed to any threads?
Scott MacVicar
Mon 23rd Sep '02, 9:57am
Erwin i just checked that if a usergroup has everything set to no apart from canview they can still unsubscribe from the subscribed threads.
Can you see any other problems with my fix?
No subscription emails will be sent if they can't view the board and if they can view the board they can definately un-sunscribe unless they have lost their password but they can get that then unsubscribe.
Chen
Mon 23rd Sep '02, 10:21am
Originally posted by PPN
Loveshack, you should add a semi colon at the end of a query to indicate that its finished, as you can run more than one query at a time.
You can't issue more than one query with mysql_query().
Erwin
Mon 23rd Sep '02, 8:58pm
Originally posted by PPN
Erwin i just checked that if a usergroup has everything set to no apart from canview they can still unsubscribe from the subscribed threads.
Can you see any other problems with my fix?
No subscription emails will be sent if they can't view the board and if they can view the board they can definately un-sunscribe unless they have lost their password but they can get that then unsubscribe.
I see... I suppose I only ban trolls, so I don't want them access to the forum at all.
But what about members who change their email addresses to an invalid one? They would be changed to awaiting email confirmation. The mail server will keep trying to send them subscribed thread emails, which will bounce back and clog up the system.
Scott MacVicar
Mon 23rd Sep '02, 9:22pm
I'll add a clause for that then
AND user.usergroupid <> '3'
Erwin
Mon 23rd Sep '02, 9:49pm
Originally posted by PPN
I'll add a clause for that then
AND user.usergroupid <> '3'
This is why I did the fix based on usergroupids. If you are going to exclude usergroupid 3, you might as well include usergroupid 8 - this way banned members unsubscribe immediately, without needing to do it manually themselves. :)
Scott MacVicar
Tue 24th Sep '02, 5:11am
the banned usergroup is not included in vBulletin as standard, my banned usergroup is 13 so that causes a problem when different boards have a different banned usergroup.
And there is no way for definate to find their banned userrgroup apart from seeing which ones can't view.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.