PDA

View Full Version : Banned members automatically stop receiving email notification on subscribed threads


Erwin
09-10-2002, 10:00 PM
NOTE: This hack is now included as standard from vB 2.2.8 upwards. :)

This is really a mini-hack.

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! :)

Spitfireisgod
09-11-2002, 08:30 PM
great addition man...

but i really don't have use for it since i rarely ban :-/

Buddha
09-12-2002, 12:18 AM
thanks for the minihack erwin... actually, this will probably come in useful.

Erwin
09-12-2002, 03:04 AM
This is almost like bug fix really... it's silly that banned members still get subscribed thread email notifications... I was sick of getting emails from banned members complaining about the emails. :)

SemperFidelis
09-12-2002, 06:51 AM
Good addition, but I probably wont install.
I find it amusing that banned members still get email notifications and not be able to see the actual threads
:D

cessna140
09-12-2002, 04:09 PM
Actually this would be great for membership types sites. When a member expires this could make sure their subscriptions are deleted too!

Erwin
09-12-2002, 07:43 PM
Originally posted by cessna140
Actually this would be great for membership types sites. When a member expires this could make sure their subscriptions are deleted too!

True. Just add or remove the usergroupid's from the line that you add to choose which usergroups can or cannot receive email subscriptions.

ZiRu$
09-13-2002, 01:46 AM
Damn....this is a must have.....installing NOW

ZiRu$
09-13-2002, 01:58 AM
when i install it i get this message

Parse error: parse error, unexpected $ in /home/blazing/public_html/admin/functions.php on line 1009

Fatal error: Call to undefined function: vbdate() in /home/blazing/public_html/admin/sessions.php on line 362

On line 362 its a blank space and on 1009 it's


$ctcensorword=explode(" ",$ctCensorWords);


un-installing the hack fixes the problem

Erwin
09-13-2002, 03:13 AM
Are you sure you put that line in the right place? This hack cannot cause a parse error, since all it does is add another "AND" requirement to the query that gets all the emails to be sent to when a new reply is made.

Without my hack, the query looks like this:



$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]'");




After my hack, the query looks like this:




$useremails=$DB_site->query("SELECT user.*
FROM subscribethread,user
WHERE subscribethread.threadid='$threadid'
AND subscribethread.userid=user.userid
AND user.userid<>'$userid'
AND user.usergroupid NOT IN (1,3,4,8,17)
AND user.lastactivity>'$lastposttime[dateline]'");



Go and install the hack again, and make sure that you are putting that extra line in the right place in functions.php - this hack does NOT and can NOT interfere with any other hack. It just adds another requirement to that specific query.

8ball
09-24-2002, 10:48 AM
thanks for this Erwin ;) !!

i keep it and will try it as soon as possible :D

Erwin
09-25-2002, 05:31 AM
There's no need to install this hack anymore. vB has included this hack as standard in 2.2.8 which is now out. :) Thanks to PPN who listened to me when I posted about this on vB.com.

Talisman
10-16-2002, 01:37 PM
Thanks for the fix, Erwin. We're still using 2.2.6.

Erwin
10-16-2002, 08:32 PM
You're welcome. :) Glad people still find this useful.

lalo landa
01-09-2003, 05:15 AM
work in 2.2.4 too

Kathy
02-01-2003, 03:15 AM
Sorry for bringing this back up...but I'd like clarification. My current functions.php has this section but I don't think it is stopping the "banned" and "email awaiting confiramtion" from getting email notifications.. Of course I have a very hacked up file so perhaps I've missed getting the right upgraded bit in my 2.2.8:

$useremails=$DB_site->query("SELECT user.*
FROM subscribethread,user,usergroup
WHERE subscribethread.threadid='$threadid'
AND subscribethread.userid=user.userid
AND usergroup.usergroupid=user.usergroupid
AND user.userid<>'$userid'
AND user.usergroupid<>'3'
AND usergroup.canview = 1
AND user.lastactivity>'$lastposttime[dateline]'");

Is there someplace I can make it so that banned, email awaiting, and another usergroup (bad email) can be unsubscribed?

Banned =usergroupid=23
users awaiting confirmation=usergroupid=3
Bad email =usergroupid=52

thanks!

Erwin
02-01-2003, 04:11 AM
Just add this line as part of that query:

AND user.usergroupid NOT IN (23,3,52)

:)

Kathy
02-01-2003, 04:17 AM
thanks Erwin.

What is this line? I don't want to mess up the query by listing a usergroupid twice:
AND user.usergroupid<>'3'

Erwin
02-01-2003, 04:32 AM
You can take that line out. :)

oldengine
05-01-2005, 02:14 AM
Can we get this for use in 3.0.7 ?