Your premium source for custom modification services for phpBB

HomeForumsBlogMOD ManagerFAQSearchRegisterLogin

Comments April 5, 2008

This Post
Talks About
Partial Finds

Filed under: MOD Writing, phpBB — Dave Rathbun @ 7:57 am CommentsComments (2) 

I learned something today. A few days ago I posted about why I think that “auto group” MODs are bad for your board. Before I go any further, let me please make one thing perfectly clear: I am not saying that the coding is bad, in my opinion it’s just a bad idea to begin with. So neither post (the first one or this one) is intended to be a criticism of the coding techniques used by any MOD author who has written this type of MOD.

So what did I learn?

Multi-Line Partial Finds

After I published the post I linked above I decided to go out and look at one of the recent phpBB2 MODs for automatic group membership. My intent was to take a look at the code and see what I missesd in my description of the process in my prior post. (For the record, I did miss an event that would call the user group process. :) ) This point of this post, however, is that while reading the installation instructions I saw this:

$sql = "UPDATE " . GROUPS_TABLE . "
SET group_type =

That’s it. That’s the entire FIND. :lol: When I looked at that the first time I thought I had downloaded a version of the MOD that was not yet approved. Clearly that FIND target does not exist. It’s not even a full block of code! When I rechecked, however, this was from a released MOD. That really confused me, so I went looking for a clarification.

It turns out that despite my confusion, this is perfectly valid. It certainly adds a new wrinkle. What it allows a MOD author to do is create a multi-line FIND target but only put a few words (or characters) from each line. In this case the words were from the beginning of each line, but I am told that even that is not required. All a MOD author has to do is provide a little bit of code from each of the lines that they want to match. A subsequent IN-LINE FIND will then use all three lines (it is three in this case, but it could be any number) as the source for potential inline matches. Hm.

I am told that this is the way FIND has always worked. It is rarely used, but it is valid.

But Is It Necessary?

Whether it is valid or not, I would be very hesitant to use it. I do not use it in any of my MODs, mainly because I had no idea it was even an option. :) Even in this specific case there is a really easy change that can be made that would eliminate the need for a multi-line partial find target. Instead of what was posted above, the following works perfectly, and is probably just as reliable on a heavily MODded board.

group_moderator = $group_moderator

That FIND target exists on line 2 of the multi-line find listed above, and it is unique in the entire file. It avoids the confusion and is a guaranteed match within the file being processed at the time.

My MOD Installer (called the Doctor MODder :lol: ) will not handle this sort of instruction as I had no idea it was available. From what I understand, EasyMOD will work fine.


I could not find a specific example in the online MOD documentation that showed this technique. I did find a brief example in the MOD documentation that describes partial finds. However, none of the examples provide show a multi-line target with partial lines. Despite this, the technique is a valid one. In my opinion, however, MOD authors should try to avoid using this technique. Even if EasyMOD or its eventual replacement can handle the syntax, it just looks strange to me. :) If a user is trying to install a MOD by hand and copies the FIND target and then does a search for that exact text… well, you can see how that would turn out.


  1. I agree with you, it’s not really logical to me either. I try to keep my MODs human installable too. I’m not sure if blinky (the phpBB3 easymod) can handle this…

    Comment by eviL3 — April 5, 2008 @ 9:07 am

  2. I asked, and was told that it should. That is assuming that I asked the right question and understood the answer. :) I got some feedback from several folks on the MOD team and the general overview is that yes, this is allowed, and that yes, it is very rare because most MOD authors don’t know about it. But it will validate.

    I would like to see if there is a case where it is required rather than convenient. But not enough to take the time to go through all of the MODs in the MOD-DB looking for examples. :lol:

    Comment by Dave Rathbun — April 6, 2008 @ 8:27 am

RSS feed for comments on this post.

Leave a comment

Tags allowed in comments:
<a href="" title=""> <acronym title=""> <blockquote cite=""> <code> <strong> <em> <u> <sup> <sub> <strike>

Confirm submission by clicking only the marked checkbox:


Powered by WordPress