PDA

View Full Version : [RELEASE] Kill File v1.0 -- ignore lists


09-27-2000, 04:06 PM
********** Kill File Hack v1.0 **********

vB Code Base used: v1.1.3 Author: ~shabang~
In action @ http://www.overgrow.com/edge/index.php
Latest version: http://www.overgrow.com/archive/KillFile.zip

The Kill File is an addition onto the wildly succesful PM hack.
This would not be possible without the fine work of Mike (Ed)
Sullivan. Some parts (a query or two) are pulled from his code.
** The PM hack is a pre-requisite to installing the Kill File. **

** DO NOT PROCEED unless you have Private Messaging **
http://www.vbulletin.com/forum/showthread.php?threadid=1772


***********************************

Design Document:

Overall:
-Allow any registered and cookied user to selectively ignore any poster.
-The handle ignored can be either registered or unregistered.
-Allow a global setting to ignore all unregistered users.

Ignore List:
-Database is already in place with PM, just need to integrate with forums.
-User can edit the ignore list in PM.
-After editing ignore list, user is sent back to the original thread.

Ignore Mechanism:
-At the bottom of every post will be an ignore button to turn it on.
-If a post is ignored, the message will not be displayed.
-Instead of the message a link to bypass the ignore setting is used.
-This link would then display the message regardless of the ignore.


This install will add 1 template: postbit_ignored
Edit 4 templates: postbit, showthread, redirect_pmignoreedited, showignore
and Edit 2 PHP files: private.php, showthread.php


Download complete instructions:

http://www.overgrow.com/archive/KillFile.zip


(if you downloaded within the first 5 minutes of my post, please download again-- I forgot one small template addition that is now fixed)



[Edited by Overgrow on 09-27-2000 at 01:17 PM]

09-27-2000, 04:33 PM
Something interesting to do after you've had this installed a few days... run this query:

SELECT user,ignorelist FROM user WHERE ignorelist !="";

And you can see who is your most ignored user :)

09-27-2000, 05:27 PM
ITs working awesome.

Quick question. Being that now the system checks the Ignore list for each and every user that views a thread....does your hack eat up system resources?

I have over 6300 registered members, and over 250 members online at once during peak hours...I want to try and stay away from hacks that eat up my system resources.

Let me know your opinion. Thanks again for all your hard work. And you to Ed! ;)

09-27-2000, 05:37 PM
I was just thinking....it would be cool if the hack was set up so that users could not ignore "Admins" or "Moderators" or "Super Moderators". This way all the necessary posts can get to the users.

Just a thought.

09-27-2000, 06:16 PM
Ahh so glad to hear that it works for you. I hope my instructions were clear. Disclaimer: I am a graphic artist that learned to program-- so I'm not really qualified to be doing this or to give you advice on your system resources... but I'll do it anyway.

This hack should only add 1 query to your showthread. That is 1 query per load of the page to fetch the reader's ignore list-- not 1 query per post. It fetches the ignore list at the top of the script when it is first loaded. It parses this list into an array.

Lower down it uses the array. Once for each post on the page, it checks to see if the poster's name is contained in the ignore array. If it is there, it switches to the _ignored template.

So you're adding 1 query per page view and 1 possibly 3 if statements per post. I don't think it should be that resource intensive.

RE: Admins & Moderators

Please correct me if I'm wrong, but the only real way to tell if someone is an Admin or Mod is to do a getpermissions and cross reference their userid with the current forum.. which would add 1 query per post on the page-- something I'm not willing to do myself.

The cheat way to do it is hardcode the user titles into showthread. Change:


if ((isset($ignore[$userid]) || isset($ignore[($username)])) || ($usertitle=="Guest" && isset($ignore[$guestcode]))) {


to



$modtitle["Drug Czar"] = "yes";
$modtitle["Administrator"] = "yes";
$modtitle["Moderator"] = "yes";

if ((!isset($modtitle[$usertitle])) && ((isset($ignore[$userid]) || isset($ignore[($username)])) ||
($usertitle=="Guest" && isset($ignore[$guestcode])))) {


And of course replace your Admin/Mod titles in the array. If you want to be more efficient, move those $modtitle variables up to the top of the script and out of the post if.

09-28-2000, 07:54 AM
I had a problem with the hack. My site was running great as of late...then after I installed the hack in sent MySQL into overtime causing the load to increase making the site unaccessable.

Just thought you'd like to know. Kind of sucks...I want to use this bad.

09-28-2000, 01:07 PM
then after I installed the hack in sent MySQL into overtime causing the load to increase making the site unaccessable.

Really sorry man.. I should've had a better disclaimer at the top of the hack. :) As far as I know it's only adding one query to the user table for each time showthread is loaded. If you use fodder's numbers, that page already had over 100 queries per view if you don't optimize the queries with Join. I'm not sure how adding 1 query can bring a system to it's knees like that.

My board goes to a max of maybe 60 users at peak and I haven't noticed a difference between pre- and post- ignore hack. Anyone want to take a guess as to why this hack might slow down VT's board?

09-28-2000, 02:30 PM
Yeah it's weird. The hackis awesome and my users are pissed cause they want it back. :)

I don't see how one query does it either. I get arond 260+ users during peak hours..maybe that's why. I am going to monitor the site again today with te hack off of it and make sure that was what it was.

09-28-2000, 03:26 PM
Overgrow - may I suggest you select your "ignorelist" in global.php on the same line where everything else is already being selected for the user instead of running a seperate query in showthread. Doing it this way will not add the same overhead even though it will effectively be available on every page.

if ($userinfo=$DB_site->query_first("SELECT daysprune,lastvisit,lastactivity,cookieuser,userna me,password,usergroupid,timezo neoffset FROM user WHERE userid=$bbuserid")) {

Add "ignorelist" to that line.

Also "ignorelist" is a blob field and that will effect performance.

[Edited by rangersfan on 09-28-2000 at 12:29 PM]

09-28-2000, 04:55 PM
this sounds like a very good start on a great hack:)

with a little fine tuning I'm sure it will become one of the more popular features at my board. I have a few users who are just PITA.

09-28-2000, 05:37 PM
Marvelous suggestion.. I removed the query out of showthread and into global. But one problem, we don't need the blobby ignorelist loaded with EVERY single page. So I made it dependent on whether it's showthread calling global.... like this:

In global.php change:


if ($userinfo=$DB_site->query_first("SELECT daysprune,lastvisit,lastactivity,cookieuser,userna me,password,usergroupid,timezoneoffset FROM user WHERE userid=$bbuserid")) {


to


if ($userinfo=$DB_site->query_first("SELECT daysprune,lastvisit,lastactivity,cookieuser,userna me,password,usergroupid,timezoneoffset".$queryinsert." FROM user WHERE userid=$bbuserid")) {



At the top of showthread.php add

$queryinsert=",ignorelist";

right above

require("global.php");


This will add ignorelist onto the global query only when showthread is the one calling. Then go into showthread.php and change the first part of the hack to:


// IGNORE HACK ************************************************** ********************************** IGNORE HACK

if ($bbuserid) {

if (!$cancelig) { // if Ignore processing is on:

$ignorelist = split("\n", $userinfo[ignorelist]);
while (list($key,$val)=each($ignorelist)) {
$val = trim($val);
$ignore[$val] = "yes";

}

$resumeignore = "<smallfont><b>Kill File:</b> ON - <a href=\"" . $REQUEST_URI . "&cancelig=on\">Bypass Ignore Processing</a></smallfont>";

} else { // if it's off:

$resumeignore = "<smallfont><b>Kill File:</b> OFF - <a href=\"showthread.php?threadid=$threadid\">Resume Ignore Processing</a></smallfont>";
}
}
//


And that will remove the query from showthread. If this works for you VT I will change it in the overall hack. I mean I have tested this fix and it works, but lets see how it does on a board with more traffic.

P.S. Please take a look this thread in our Shark Tank (http://www.overgrow.com/edge/showthread.php?threadid=13485). It's about message board communites and how we handle our problem users. Feel free to leave your own comments as owners of large message boards, you don't need to register for the Shark Tank. (The tank is our catch all for crap posts-- we never delete anything, just move it to the Tank in the spirit of free speech.)

09-29-2000, 01:58 AM
Overgrow - I noticed that you took the ignore feature off of your site. Was it not working well for you?

Why did you take it off?

Thanks. Just curious if it caused load problems or something.

09-29-2000, 07:28 AM
Sorry, it is still there. I haven't taken it down at all-- I think what happened is you weren't logged in. I was messing with the cookies this week and I had it only setting temporary cookies... so when you came back, you weren't logged in and you had no ignore list.

I've fixed the temp/perm cookies now and also implemented the above query fix-- all is well on my little 60-concurrent-user board :)

09-29-2000, 07:49 AM
I really hope this makes it into the next vB. After all, what's the point of having dynamically-generated thread pages if you can't further control what you see (like this hack lets you)?

This is one cool hack!

09-30-2000, 10:59 PM
Did the fix...putting it in global make it faster?

10-01-2000, 02:37 AM
Jim it should make no change on your forum speed now. Try it out.

10-04-2000, 05:29 AM
Is the zip version the most efficient and updated one?

Thanks!

10-11-2000, 06:21 AM
Hello Overgrow,

I wanted to run the SELECT query you suggested to see who the most ignored user was. So I created a file called most_ignored.php. It looks like this:

<?php

chdir($DOCUMENT_ROOT);
require($DOCUMENT_ROOT . "global.php");

$loggedins=$DB_site->query_first("SELECT user,ignorelist FROM user WHERE ignorelist !=''");
$user=$loggedins[user];

echo "$user";

?>



But I get this error:

Database error in vBulletin: Invalid SQL: SELECT user,ignorelist FROM user WHERE ignorelist !=''
mysql error: Unknown column 'user' in 'field list'
mysql error number: 1054
Date: Wednesday 11th of October 2000 02:23:38 AM
Script: /etc/most_ignored.php


I also tried running the query in phpMyAdmin and got the same error. Any ideas?

10-11-2000, 03:27 PM
I have updated the zip file to 1.1 to reflect the query optimizations by rangersfan. You can find the newest version, including instructions on updating the old version, here:

http://www.overgrow.com/archive/KillFile.zip


VT, I'm working on that most ignored script. I'm sorry I had quoted that query incorrectly-- there is no field "user" in the table "user"... the query should be:

select username,ignorelist from user where ignorelist !="";

I'm working on the file so it will give the results you want.. will post in a bit.

10-11-2000, 04:20 PM
OK VT, once you get me started... Here is a little script that will report your kill file stats (who is being ignored). Save it with any name in the same directory as your forum index.php.



<?php

require("global.php");

echo "<font face=verdana,arial size=2><b>username</b>: who they are ignoring<br>&nbsp;<br>";

$ignorequery = $DB_site->query("SELECT username,ignorelist FROM user WHERE ignorelist !=''");

while($ui=$DB_site->fetch_array($ignorequery)) {

$user=$ui[username];
$ignorelist=$ui[ignorelist];

echo "<b>$user</b>: ";

$ignorelist2 = split("\n", $ui[ignorelist]);

while (list($key,$val)=each($ignorelist2)) {
$val = trim($val);

if ($val!="" and strlen($val) > 1) {

$id=intval($val);
if ($check=$DB_site->query_first("SELECT username FROM user WHERE userid=$id")) {
$val = $check[username];
}

echo "\"$val\" ";
$icount[$val] = $icount[$val] + 1;
}

}
echo "<br>";

}

echo "&nbsp;<br>";

asort($icount);

while (list($key,$val)=each($icount)) {
echo "$key has been ignored $val times.<br>";
}

?>

10-11-2000, 11:10 PM
Hello Overgrow,

No reason to apologize...thanks a bunch. It works!

:)