[BETA] Ignore Suite 1.1.0

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
nfs
Registered User
Posts: 49
Joined: Mon May 16, 2005 10:04 pm

[BETA] Ignore Suite 1.1.0

Post by nfs »

MOD Title: Ignore Suite
MOD Description: Adds ability to ignore users (posts and private messages). Administrators and moderators cannot be ignored.
MOD Version: 1.1.0

MOD Download: http://www.financialwebring.com/gallery/ignore110.zip
Last Stable version: n/a

This code is based on Simon Pitfield's ignore suite (see this thread), which seems to have been abandoned about two years ago. I built on this code because IMO Simon's code has superior functionality when compared to the two other MODs that are currently in development (Simple Ignore 1.4.0 and User Ignore 1.2.0).

I started using this MOD when Simon had it at version 1.0.4. At the time, it was very buggy and some bugs were fixed - and announced here - before it was abandoned at v1.0.6. For those who are interested in what's changed between the abandoned v1.0.6 and this v1.1.0, this is right out of the version history in the MOD header.
## 2006-06-16 - Version 1.1.0
## - updated for phpBB 2.0.21
## - renamed table to conform to naming standards
## - cleaned up table reference in privmsg.php
## - PMs from administrators and moderators cannot be blocked
## - changed all occurrences of subsilver to subSilver
## - fixed bug in search code
## - removed chattiness coded into ignore/unignore in 1.0.5

It passes basic MOD validation. Easymod says that it's not EM-compliant but I have no idea why and this has installed via Easymod since 2.0.18 without trouble (back to 2.0.11 with minor tweaks). This code has been in use for about 18 months now - ~1000 users, 100-150 posts per day - with nary a squawk since the search bug was fixed about a year ago.
nfs
Registered User
Posts: 49
Joined: Mon May 16, 2005 10:04 pm

Post by nfs »

I have had a report by PM that an attempt to install this code via Easymod has failed on a memory allocation error. I can't duplicate that error on my own server (phpBB 2.0.21, EM 0.3.0) so I would much appreciate someone else acting as a guinea pig.

Volunteers?
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Installed successfully on localhost. The list shows users 2 times...
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
nfs
Registered User
Posts: 49
Joined: Mon May 16, 2005 10:04 pm

Post by nfs »

eviL<3 wrote: The list shows users 2 times...

I guess I'm a little thick today. What does this mean?
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

2 times = twice... But actually now they don't anymore. When i tried it last time, the ignored user was displayed 2 times. Now it works okay.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
TheFiniteMonkey
Registered User
Posts: 3
Joined: Mon Jul 26, 2004 7:56 pm

Post by TheFiniteMonkey »

I wanted to install this mod, but found a conflict because I already have "Keep Unread Flags 2.0.5a" installed. This ignore mod includes the following code for modifying search.php:

Code: Select all

# 
#-----[ FIND ]------------------------------------------ 
#
	WHERE post_time >= " . $userdata['user_lastvisit'];

# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
;

# 
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------ 
#
 . $ignored_sql
The "keep unread" mod already modified code in that section, though, so it looks like:

Code: Select all

//START MOD Keep_unread_2
				$list_unreads = implode(',', array_keys(list_new_unreads($dummy, $toggle_unreads_link)));
				$sql = "SELECT post_id, topic_id, forum_id, post_time
					FROM " . POSTS_TABLE . "
					WHERE ";//post_time >= " . $userdata['user_lastvisit'] ;
				$sql .= ($list_unreads != '')	? " topic_id IN (" . $list_unreads . ")" : " topic_id=-1";
//END MOD Keep_unread_2
Since I don't really get how the underlying code works, this is a case where I can't tell where to insert that bit of code that the ignore suite mod wants to insert. I don't think I can just paste it where it would normally go, because that part was already commented out by "keep unread". Is there a way to have both mods working and getting along?

Thanks for keeping this mod going - it's a very useful feature. (I'm hoping it will be standard in the next major version upgrade.)
nfs
Registered User
Posts: 49
Joined: Mon May 16, 2005 10:04 pm

Post by nfs »

A quick glance suggests that something as simple as inserting

Code: Select all

$sql .= $ignored_sql;
just before the "// END MOD Keep_unread 2" comment instead of the original IN-LINE ADD will likely do the trick.

Not tested in any way, just a desk check.
TheFiniteMonkey
Registered User
Posts: 3
Joined: Mon Jul 26, 2004 7:56 pm

Post by TheFiniteMonkey »

After that suggestion, I initially tried this:

Code: Select all

				//START MOD Keep_unread_2
				$list_unreads = implode(',', array_keys(list_new_unreads($dummy, $toggle_unreads_link)));
				$sql = "SELECT post_id, topic_id, forum_id, post_time
					FROM " . POSTS_TABLE . "
					WHERE ";//post_time >= " . $userdata['user_lastvisit'] ;
				$sql .= ($list_unreads != '')	? " topic_id IN (" . $list_unreads . ")" : " topic_id=-1";
. $ignored_sql
				//END MOD Keep_unread_2
...but that didn't work. I got some error about an unexpected "." So then I tried this:

Code: Select all

				//START MOD Keep_unread_2
				$list_unreads = implode(',', array_keys(list_new_unreads($dummy, $toggle_unreads_link)));
				$sql = "SELECT post_id, topic_id, forum_id, post_time
					FROM " . POSTS_TABLE . "
					WHERE ";//post_time >= " . $userdata['user_lastvisit'] ;
				$sql .= ($list_unreads != '')	? " topic_id IN (" . $list_unreads . ")" : " topic_id=-1". $ignored_sql;
				//END MOD Keep_unread_2
That appears to have worked, though I'm not expert enough to declare complete success and wouldn't want to lead other users toward more trouble in case I've goofed and just don't know it yet. That latter tweak may have been what you (nfs) meant in the first place, but it took me one failed attempt at trying the suggestion before trying a way that appeared to work. Thanks for the help. (Also, if you can see I've somehow blundered with the above tweak, feel free to point it out. I'm one of those people who can figure out how to use and tweak this stuff without truly understanding the code, which can make me my own worst enemy sometimes.) :?
Stefani
Registered User
Posts: 58
Joined: Tue Aug 19, 2003 7:55 pm

Post by Stefani »

Quick question, I hope.

In your instructions you have this for privmsg.php:

Code: Select all

#-----[ FIND ]------------------------------------------ 
#
			$to_userdata = $db->sql_fetchrow($result)
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
			if ( $userdata['user_level'] == USER && isset($ignored_ids[$to_userdata['user_id']]) && $ignored_ids[$to_userdata['user_id']] ) 
			{
				$error = TRUE;
				$error_msg = $lang['Has_ignored']); 
			}

My code looks like this:

Code: Select all

if (!($to_userdata = $db->sql_fetchrow($result)))
Am I supposed to insert that code within this phrase? So it looks like this?

Code: Select all

			if (!(if ( $userdata['user_level'] == USER && isset($ignored_ids[$to_userdata['user_id']]) && $ignored_ids[$to_userdata['user_id']] ) 
			{
				$error = TRUE;
				$error_msg = $lang['Has_ignored']); 
			}$to_userdata = $db->sql_fetchrow($result)))
It looks wrong to me. Please advise. Thanks in advance.
Stefani
Registered User
Posts: 58
Joined: Tue Aug 19, 2003 7:55 pm

Post by Stefani »

Or should I add it like this to make it all balanced?

Code: Select all

			if ( !($result = $db->sql_query($sql)) )
			{
				$error = TRUE;
				$error_msg = $lang['No_such_user'];
			}

if ( $userdata['user_level'] == USER && isset($ignored_ids[$to_userdata['user_id']]) && $ignored_ids[$to_userdata['user_id']] ) 
			{
				$error = TRUE;
				$error_msg = $lang['Has_ignored']); 
			}
			

			if (!($to_userdata = $db->sql_fetchrow($result)))
			{
				$error = TRUE;
				$error_msg = $lang['No_such_user'];
			}
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

It should be this way:

Code: Select all

         if ( $userdata['user_level'] == USER && isset($ignored_ids[$to_userdata['user_id']]) && $ignored_ids[$to_userdata['user_id']] )
         {
            $error = TRUE;
            $error_msg = $lang['Has_ignored']);
         }

         if (!($to_userdata = $db->sql_fetchrow($result)))
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
Stefani
Registered User
Posts: 58
Joined: Tue Aug 19, 2003 7:55 pm

Post by Stefani »

Whoo hoo! You are the best! Thank you for replying. That did the trick.

NFS: thank you very much for this great mod! Just what my members needed as conversations were getting a little testy of late.
nfs
Registered User
Posts: 49
Joined: Mon May 16, 2005 10:04 pm

Post by nfs »

cheesypeanut deserves the credit. To be honest, my contribution was finding and fixing half a dozen bugs.

In my opinion, it's a cracking good MOD for boards with posters who can't help stepping on one another's toes. Moderators and admins can concern themselves with outright trolls and let members sort out for themselves who isn't worth reading or getting angry about.

Next project for me (but it will have to wait for a rainy week in winter) is sort of the opposite of this one: not "ignore this user" but "watch this user". I have a request from one of my moderators who wants it to keep an eye on potential troublemakers but it would be useful for regular users too who want to be informed whenever someone posts. For some, it's because they think it's worth reading anything a particular person writes. For others, it's because they think it's worth rebutting anything a person writes. ;)

P.S. If you had to modify the code as eviL<3 suggested, you must be running an old version (I would guess 2.0.15 or earlier). You should probably upgrade.
Stefani
Registered User
Posts: 58
Joined: Tue Aug 19, 2003 7:55 pm

Post by Stefani »

I am up to date with the phpbb. Running 2.0.21, but I do have a few mods. I had to rework your menu part as well as I have my menu set up differently.

Take a look at my site:
http://lizzieandrewborden.com/LBForum/index.php

Thanks again.
Stefani
Registered User
Posts: 58
Joined: Tue Aug 19, 2003 7:55 pm

Post by Stefani »

OOPS. I spoke too soon. Please help. My code change made the PM feature fail. Here is the code:

Code: Select all

			if ( !($result = $db->sql_query($sql)) )
			{
				$error = TRUE;
				$error_msg = $lang['No_such_user'];
			}

if ( $userdata['user_level'] == USER && isset($ignored_ids[$to_userdata['user_id']]) && $ignored_ids[$to_userdata['user_id']] ) 
			{
				$error = TRUE;
				$error_msg = $lang['Has_ignored']); 
			}
			

			if (!($to_userdata = $db->sql_fetchrow($result)))
			{
				$error = TRUE;
				$error_msg = $lang['No_such_user'];
			}
		}
Here is the error message:

Parse error: syntax error, unexpected ')' in privmsg.php on line 1215

I guess it is wrong. Can you assist nfs?
Post Reply

Return to “[2.0.x] MODs in Development”