October 24, 2003

Using phpBB as your MovableType comment engine in 23847392 easy steps (, )

by fluffy at 1:52 PM
Here's a writeup which should at least help other people get MovableType (or anything else which is based on or can otherwise embed PHP) and phpBB working together, if they so desire.

It's not difficult (especially if you already have phpBB set up and working), but it's time-consuming.

2008/03/31 Note that I'm not actively developing this anymore. Notably I have no plans of upgrading it to work with phpBB 3.

2005/02/22 Added a 'url' column to the table; now recent discussion can work a bit better for people who use fancy-pants archive URLs (at least for new installations; if anyone needs help populating their table for existing installations just let me know).

2004/07/02 Added some more anti-spam measures.

2004/11/20 Some more wording changes to hopefully clear up a few parts of the installation.

But first, you might ask why this might be a good idea. After all, doesn't MovableType already have a built-in comment engine, and doesn't MT-Blacklist already solve the spam problem? To an extent (though it's not yet a silver bullet), but there are still other reasons to move to phpBB:

  • Optional user registration — wouldn't it be nice if people could ensure that other people can't post as them?
  • Discussions involve more than just the weblog author posting and random people responding to the author. There is an interchange between multiple users. So, it'd be nice if users could track replies to their posts too.
  • Better moderation interface — if you've ever tried to delete multiple comments from multiple weblog entries, you know how frustrating it is in MT to have to wait for one thread's comments to finish deleting before you can start deleting on another thread, because of the stupid Javascript-based "dialog box" for comment moderation. phpBB's UI is actually designed to act like a webpage, not a Windows app.
  • A homogenous comment engine landscape makes it easy for spammers to come up with single catch-all spam tactics. A variety of comment engines makes their life more difficult.
  • Better comment search capabilities.
  • Private entries
  • And the main reason I wanted to do this: I already had a perfectly-good forum which took a lot of effort to install and so on, which nobody uses. I didn't want to see the effort go to waste. :D
So, here are all the steps it takes in order to get a working MT+phpBB installation.

Before you begin

In order for the best results, you need a few basic things:
  • Basic programming skills — not necessarily in PHP (this was my first original piece of PHP code, actually), but just in basic programming concepts in general.
  • An understanding of how directory layouts are put together — basically, understanding the difference between absolute and relative paths, and how this relates to a website compared to the actual file system it's based on.
  • Knowledge of how to apply examples to your own ideas — like MovableType's default templates, this stuff is only intended as a starting point. With this code you can make the level of integration between MovableType and phpBB as complex or as simple as you want.
  • Access to a raw SQL command line (to set up the table), since writing an installer for this would be much more complex than just giving the one SQL command which is needed...
I've tried to keep these instructions as simple and general as possible, but since basically every hosting setup and website is different, there's no single generic set of cookie-cutter configuration parameters which will work for everyone, or even for half of the people who will be installing this. So, basically, the instructions are geared towards how I set this up on my own website, with explanations on how to adapt it to your own setup wherever necessary.

Of course, the instructions are always being refined and worked on, so if there's something which is unclear or confusing (or if you have any ideas on how to improve any part of this), feel free to post a comment!

So, let's go on to the actual installation.

Have both MovableType and phpBB installed and working.


Well, not quite duh. Both things need to be running from the same server, and need to be on the same hostname/domain/etc. So you can't have, for example, and and expect it to work as described here - it has to be and It's possible to get it working across sites (as long as they're still hosted on the same server and account and so on, or even if they're on different servers in some cases), but tricky and outside the scope of this writeup.

Have MT emit all pages as PHP instead of raw HTML.

This is pretty simple; just go into "weblog config," then select "configuration," then scroll down a bunch and change the archive extension from 'html' to 'php'. Then go to "templates," then edit all of your index templates to have them emit the file with a .php extension instead of .html. (Yes, that includes the main index.) Also, be sure to delete any old index.html so it doesn't override the index.php.

Rebuild, and fix all of your broken permalinks.

This is the time-consuming bit. First, you have to go through your weblog entries and then make sure that any internal linking you have going on points to the current .php version, rather than current .html. Then you have to worry about external links into your weblog, search engines, and so on. So, there's an easier way to handle this, which is less elegant but keeps things from breaking. Assuming that you have shell access on your webhost, log in, go into your archive directory, and then run this simple command:
sh -c 'for i in *.html ; do redir=`basename $i .html`.php ; echo "<html><head><meta http-equiv=\"refresh\" content=\"0;$redir\"></head><body><a href=\"$redir\">This page has moved, sorry</a></body></html>" > $i; done'
Be sure it all goes on one line and so on. Whee.

  • Install a few phpBB modifications: For that last one, you'll need to also create an SQL table. Get into whatever command-line interface you have for your SQL server, and run the following command:
    CREATE TABLE phpbb_integrate (source CHAR(50), topic INT, url VARCHAR(250));

    Note that you can call the table and columns whatever you want (in case the default names step on your SQL implementation), but make sure to change the respective settings at the top of if you do.

    Create a place for threads to be put.

    Create a new forum, which is set so that only administrators can post to it. (You'll definitely want a separate forum for this stuff; one look at the fluffyblog forum area will show you why.)

    Optionally, create a posting bot user, which will be what creates all of the threads (it's nice to keep it separate from your own account for a number of reasons). It doesn't actually have to have administrative access, since the thread creation stuff bypasses it nicely; this weblog's forumbot doesn't even have logins enabled (accomplished by setting "user is active" to "no" from the user administration page).

    Prepare your weblog for accessing phpBB.

    In order to make use of phpBB functionality, your weblog's pages need to know how to access it. Like in most programming languages, we do this simply by "including" a module, similar to a .h file in C/C++.

    At the very top of each page template (even before the <DOCTYPE> tag if you have it) you need to put code which looks something like this:

    $phpbb_root_path = "[relative path to phpBB]";
    include($phpbb_root_path . '');
    include($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx);
    include($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx);
    include($phpbb_root_path . 'mods/phpbb_fetch_all/users.' . $phpEx);
    $display_userdata = session_pagestart($user_ip, PAGE_INDEX);
    What this does is includes the phpBB_integrate module as well as the necessary parts of phpBB_fetch_all, and then starts a phpBB session. (Unfortunately, phpBB requires a session to be active for posts containing BBcode to be parsed.)

    That bit which says [relative path to phpBB] needs to be replaced with the actual relative path to phpBB. The relative path is the way you get from one place to another without any known fixed reference point. The way you determine the relative path is fairly simple:

    • Start out totally empty
    • For each directory you have to go up, add ../
    • For each directory you have to go down, add its name ending with a /
    So, for example, if the particular page is and your forum is, then you have to go up three directories and then into phpBB2, so the relative path is ../../../phpBB2/, so the full line of code would be
    $phpbb_root_path = "../../../phpBB2/";
    Note that the relative path isn't the same for every page on your site. For example, from the top weblog directory the relative path would be just ../phpBB2/ (one set of dots). So you need to think about where the page is going to be generated when you put that initial line on the template.

    Another common configuration is where you have the weblog as the top-level directory for your site and the forum directly beneath it (for example, for the weblog and for phpBB). In this case, the relative path from the top-level directory would just be "forum/". Note that a relative path never begins with a /.

    Get MT to create phpBB threads as needed.

    Create a new template module (from the "templates" screen in MT). Call it GetForum, and give it this content:
    GetMessage("mt_<$MTEntryID$>", FORUM_ID, BOT_ID, substr("<$MTEntryTitle encode_php="qq"$>", 0, 60), "Permanent link to <a href=\"<$MTEntryPermalink$>\"><$MTEntryTitle encode_php="qq"$></a>\n\n<b>Excerpt:</b> <$MTEntryExcerpt encode_php="qq"$>", 0, USER_ID, "<$MTEntryPermalink encode_php="qq"$>")
    This code essentially makes a macro which you call using <$MTInclude module="GetForum"$>, which expands to all of the ugly crap needed to get the post's thread ID.

    Note that you can change the format of the message as much as you like, but the content will be set in stone (barring manual editing later) once the thread is created. There's no easy way to rebuild the first post on each thread right now (and any way which would come later would still be horrible and kludgy), so be sure you're happy with the format now.

    Also note that this format (with <a href> instead of that [url] crap) might not work if you haven't configured phpBB to allow the A tag in posts. [url] sucks for a number of reasons, not the least of which being that it forces target="_blank" which, especially in this case, makes the integration between the weblog and the forum very annoying.

    Also, that code isn't quite finished yet; notice the FORUM_ID, BOT_ID and USER_ID? The first one is the ID of the forum which posts go into, the second is user ID of the posting bot, and the last one is your user ID (so that you'll be emailed notifications to comment posts). (To get the user ID, look at their entry on the member list. For example, my ID is 2, which you can see by looking at the URL.)

    Finally, that code above sets the thread creation time to the time when the PHP script runs, rather than the time of the weblog entry. It's simpler than trying to account for timezone issues and clock skew and so on, and it's not as if the thread creation time will be visible on the weblog entry anyway, so there's no point in really worrying about it. (I did for a while and all it caused was headaches.)

    Change your comment display and form.

    This is where the little switch gets thrown that replaces your comment engine. The rest of this document is just to give better integration with the rest of MT and the comments; after performing this step and rebuilding the weblog, you'll (hopefully) have a working MT-phpBB setup!

    So, the first thing you want to do is back up your templates, because we're about to change them a whole bunch.

    Done with that? Good!

    This comment engine is incompatible with the popup-based comment viewing thing. But that's okay, because the popup-based comment viewing thing is an absolutely atrocious user interface for quite a few reasons which I won't get into. But, this means that you need all comments to happen on the individual entry archive listings, which means that permalinks must point to it. So, change your weblog configuration to have "individual entry archive" as the default permalink destination.

    Go to the individual archive template and replace your entire comment listing and posting form with this ugly garbage, adjusted for your own CSS: (this isn't exactly what I do — I put a lot of the functionality into a PHP include file — but it's a good starting point)

    <div class="comments">
    <div class="comments-head"><a name="comments"></a>Comments</div>

    <!-- insert whatever you normally do to display a MovableType comment here -->

    $thread_id = <$MTInclude module="GetForum"$>;

    $CFG['posts_limit'] = 0; // Unless you really feel like implementing pagination
    $CFG['posts_order'] = 'p.post_time ASC'; // to make the comments go in the right oder
    // put other phpbb_fetch_all configuration stuff here as appropriate
    // (see fetch_all's documentation for details)

    $posts = phpbb_fetch_thread($thread_id);
    for ($i = 1; $i < count($posts); $i++)
        echo "
    <div class=\"comments-body\">
    <div class=\"posted\">
    (<a name=\"#fp$i\" href=\"#fp$i\">$i</a>) <span class=\"subject\">";
    echo ($posts[$i]['post_subject']);
    echo "</span> by <span class=\"author\">";
        if ($posts[$i]['user_id'] != -1)
            echo "<a href=\"" . $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $posts[$i]['user_id'] . "\">" . $posts[$i]['username'] . "</a>";
            echo $posts[$i]['post_username'] . " (unregistered)";
        echo "</span> on <span class=\"posttime\">" . $posts[$i]['date'] .
            " " . $posts[$i]['time'] . "</span></div>" .
        echo "</div>";

    echo "<a href=\"".$phpbb_root_path."posting.php?mode=reply&t=".
        $thread_id."\">Post a comment</a> (<a href=\"".$phpbb_root_path.
        "viewtopic.php?t=".$thread_id."\">view forum</a>)<br>
    (comments powered by <a href=\"\">phpBB_integrate</a>)";


    That's a mouthful, isn't it?

    The summary is that basically you're replacing everything inside <MTEntryIfCommentsOpen>...</MTEntryIfCommentsOpen> (including the tags) with that php function, which prints out the php thread and provides a link for posting a comment. You still want to keep the old comment display (you don't want to throw out all of those old comments, right?) but don't want to keep the old comment form.

    You may notice that there's no new comment form, and just a link to the reply page. It's possible to get a full comment form in there, but it's a bit of work and it makes registered users a LOT harder to deal with. It also makes it much easier for spammers to spam. However, if you really want it, HexAngel has written up how to add a comment form to the page.

    So, as soon as you rebuild the site, you should be using phpBB for all new comments. Post a test comment, and remove or otherwise disable mt-comments.cgi (otherwise scripts can still post to your entries).

    The rest of this is just icing.

    Get the correct comment counts.

    In your weblog you probably have a few places where you have something like
    <a href="<$MTEntryPermalink$>"><$MTEntryCommentCount$> Comments</a>
    Obviously, this needs to be fixed. Create a template module called CommentLink:
    $commentcount = <$MTEntryCommentCount$>;
    if ($thread_id = GetThread("mt_<$MTEntryID$>")) {
      $thread = phpbb_fetch_topics($thread_id);
      $commentcount += ($thread?$thread[0]['topic_replies']:0);
    printf ("<a href=\"<$MTEntryPermalink$>?comments=$commentcount\">$commentcount Comment" . ($commentcount != 1?'s':'') . "</a>");
    Then, just use <MTInclude module="CommentLink"> to link to your entry with the comment count. Of course, you can customize that template module in order to change the format and so on; as written, it'll just make it a link to LINK?comments=COUNT with the text "COUNT Comments" (and as a bonus, if there's exactly one comment it'll just say "1 Comment"). (The reason for the ?comments=COUNT bit is that it makes for a convenient way to see if there's new comments.)

    Recent discussion list

    If you have a box for recent discussions, you'll have to adapt it for the new comment engine. It won't include discussions in the old comment engine, but that shouldn't matter for long anyway. Here's the PHP in my discussion box (more or less); adapt it for your own needs:
        $sql = "SELECT t.topic_title, i.source, t.topic_replies, t.topic_id, i.url FROM " .
            TOPICS_TABLE . " as t, " .
            POSTS_TABLE . " as p, " .
            INTEGRATE_TABLE . " as i " .
            "WHERE t.forum_id = 11 AND t.topic_last_post_id = p.post_id
                         AND t.topic_replies > 0 AND t.topic_id = i.topic
                         ORDER BY t.topic_type DESC, p.post_time DESC LIMIT $lastn";
        $result = $db->sql_query($sql);
        while (($row = $db->sql_fetchrow($result)))
            $numcomments = $row['topic_replies'];
            $link = $row['url']?$row['url']:sprintf("<$MTArchiveURL$>/%06d.php?comments=$numcomments",
                       substr($row['source'], 3));
            $title = $row['topic_title'];
            if (strlen($title) > 30)
                    $title = substr($title, 0, 28) . "…";
            echo "<li><a href=\"$link\">" .
                    $title . "</a> (" .
                    $numcomments . 
    Note that this doesn't use fetch_all and instead just does its own raw SQL query on the forum database, since fetch_all always fetches and formats every single comment on the thread — when we only want the topic and reply count. (This also works much better when many of the recent threads have no replies.) This means that if you want to change the format of this script (e.g. adding the name of the last poster or whatever), prepare to learn all about SQL and inner joins (or hunt around on for an older version of this page which uses the old fetch_all-based script). You're on your own.

    Also note that this will not work if you use permalink URLs which are different than the MovableType default of e.g. 000123.php. In the future I may fix this behavior if so requested.

    Rebuild your site.

    if all went well, you should be done.

    If not, well, feel free to post a comment here, because my installation actually works. ;)

    Care and Feeding

    From now on, pretty much all maintenance tasks happen from the phpBB end of things. You can still select whether comments are on or off from the MovableType end of things (with "open" or "none"), but closing comments happens from the phpBB side (by locking the thread). If you delete an entire thread in phpBB it'll be recreated the next time the entry is viewed, so if you want to kill comments and keep them gone you should probably turn off comments for the entry first.

    If you missed this step above, you should definitely remove or disable mt-comments.cgi; otherwise spammers will still be able to spam your entries, and what's worse is the spam will appear above all legitimate comments.

    If you want to back up your phpBB database (for migration to another server or for safety or whatever), it's better to just use a raw SQL dump, because the phpBB backup/restore process doesn't always restore all of the necessary data. If you do use the built-in database backup mechanism, make sure to put "integrate" (or whatever you named your table) into the custom table list. (Otherwise none of your threads will be associated to your weblog entries anymore, and all-new empty threads will be created.)

    If you change your archive permalinks, you'll probably want the 'url' table column to get updated. If so, just uncomment the line in GetMessage (in which comes right before // Thread already exists, yay!. After a while you'll probably want to re-comment it, though.

    Then the next time the page is viewed, the permalink column will be updated, so things like the recent discussion list and so on will use the new URL. (This won't update the permalink in the forum bot's post, however. Also it will incur a bit more of a hit on your database, though the actual performance impact is probably minimal.)

    Some extra hints/tips

    Since the whole point for me to move to phpBB was to reduce spam, you might want to take some simple anti-spammer measures for the phpBB side of things:
    • Write a robots.txt site for your file which looks something like this:
      User-agent: *
      Disallow: /forum/posting.php
      Disallow: /forum/profile.php
      Disallow: /forum/memberlist.php
      This will prevent spammers from finding your forum (via Google or other search engines) as a place for easy registrations (since even incactive registrations can still be used to spam links onto your memberlist).
    • For even tighter protection against spam registrations, try a couple of simple mods (which prevent the use of the member list as a link farm).
    • Also, there are phpBB spambots now, so stop those guys dead too.
    • Don't just use my boilerplate code! Learn how to interface with phpbb_fetch_all in order to get more niftier stuff going. Like, adding in avatar icons and session stuff (like with my login/logout/register links here), polls, or whatever! This code is just a starting point, just as the default MovableType templates aren't intended to be the final look and feel of your weblog. You've probably spent a lot of time customizing your MT display, so why stick to the basics for phpBB-MT integration?
    • Put commonly-used code into a PHP include file. It makes maintenance a lot easier, and also lets mod_php do some bytecode caching and so on. (I won't go into detail about this step, since hopefully by the time you get to this point you'll have enough basic skills with PHP to simply look at that file and figure out what needs to be done.)
  • Comments

    #5472 fluffy 10/24/2003 12:54 pm
    This thread occasionally gets cleaned up; any non-general-interest posts get swept into a new topic.

    Archived discussions:

    phpBB_integrate support
    archived phpBB_MT posts, round 2
    Even more archived phpBB-integrate support thread posts
    Theological poop! More phpBB+MT support!
    #1093 PromoGuy 10/27/2003 04:01 pm
    I love this, I have wanted to do this for a long time.

    The only thing I want to do differently is make it selective, for certain posts, and others just use comments. Hm, but if I could only do one, I'd use phpBB.

    Thanks, gonna try this tonight (if real life permits).
    #1094 fluffy 10/27/2003 04:37 pm
    That's pretty easy to do too. Just do something like:

    <!-- Insert MT comment display here -->
    <!-- insert MT comment form here -->
    <!-- insert phpBB comment display and forum link here -->

    That way, if you have comments set to 'closed' it will use phpBB, 'open' it will use MT, and 'none' it'll use neither.
    #1471 HexAngel (unregistered) 12/15/2003 08:23 pm Mod Rewrite can fix your permalinks
    The step listed as Rebuild, and fix all of your broken permalinks. can be a big nasty task.

    There's a quick fix solution for folks on Apache servers with MOD_REWRITE installed. All they have to do is add a redirection rule to the .htaccess file.

    Something like this, I imagine, NOT TESTED!!!

    RewriteEngine on
    RewriteBase /MyBuggyBlog

    RewriteRule (.+\.)html $1php  [R]
    RewriteRule archives/(.+\.)html archives/$1php [R]

    Which basically gets executed as

     Whenever some user looks for a file in the MyBuggyBlog directory OR
     the archives directory in MyBuggyBlog
           Check and see if the file they're looking for ends with ".html"
            If it does, give them the file of the same name ending with ".php"
            Oh yeah, [R], so update the URL in the user's browser address bar

    Of course, you can leave the [R] out and your visitors will think they're looking at an html page.

    MOD_REWRITE is your friend.

    Of course, if you've got a ton of legit HTML in your blog directories, you're going to have that issue to deal with now.


    #1536 HexAngel 12/23/2003 01:23 am

    your display code assumes comments listed in desending order, from oldest to newest. I've got mine set for ascending, newest to oldest, which the display code above displays incorrectly (misses the most recent post, then lists the Bot post last.)

    I hard-coded a solution into your display code as follows

    for ($i = 0, $di=1; $i < count($posts)-1; $i++, $di++)
        echo "
    <div class=\"comments-body\">
    <div class=\"posted\">
    (<a name=\"#fp$di\" href=\"#fp$di\">$di</a>) <span class=\"subject\">";

    It would be better to create a decision statement to determine the current sort order and preset loop parameters appropriately, but I was too lazy to look up the necessary variable or MT Tag required.


    #1539 fluffy 12/23/2003 02:17 am
    Well, considering that my code is just an example to get people started, and that you're the one who knows about your sort order better than I do, maybe you should be writing your own code anyway?

    Not to be rude or anything, but seriously. This isn't expensive supported software here, this is a simple phpBB plugin I wrote for the purpose of integrating external content management systems with phpBB, and a series of instructions detailing how I specifically went about integrating MT with phpBB for my weblog. The entire programming reference is available to you, just as it is with MT templates. If you want to write your own functionality, you're free to do it.

    It's not up to me to support every possible permutation of layout, template, and MT configuration that other people may be interested in. I'm just giving people a good starting point by showing how I happened to go about doing it.
    #1638 Anonymous 01/06/2004 05:46 am
    Your script looks amazing, it's exactly what I've been looking for - but I have one very important question.

    I don't want to create a thread on my message board everytime I create a new entry in my blog. But if people want to comment on my entry I want them to be able to click "Comment on entry" and THEN create the thread.

    Otherwise it's just going to be lots of empty threads, because people don't comment on all my entries.

    Is this possible?!

    Thanks so much in advance.
    #1640 Foo Fighter 01/06/2004 07:09 am
    I don't want to create a thread on my message board everytime I create a new entry in my blog. But if people want to comment on my entry I want them to be able to click "Comment on entry" and THEN create the thread.

    Otherwise it's just going to be lots of empty threads, because people don't comment on all my entries.

    That's basically how Fluffy's code works. The only difference is threads are also created when someone clicks "View Forum" as well.
    #1643 fluffy 01/06/2004 09:30 am
    Foo Fighter is mistaken. The thread is created when the post is first viewed.

    However, you can still use my code to do the delayed-creation behavior which you want. For example, you can have it so that at the very top of the page, before any HTML is emitted, you have something like:

    if (($mode = _GET["redir"])) {
        $thread = GetThread("mt_<$MTEntryID$>");
        if (! $thread)
            $thread = GetMessage(...);
        if ($mode == "post")
            prog = "reply.".$phpex;
            prog = "viewtopic.".$phpex;
        $url = $_SERVER['HTTP_HOST']
                         . dirname($_SERVER['PHP_SELF'])
                         . "/" .$phpbb_root_path . $prog . "?t=" . $thread;
        header("Location: " . $url);

    then change your comment display to use GetThread() instead of GetMessage(), and have the links point to "?redir=view" or "?redir=post" instead.

    It just takes a little imagination. Razz

    I'd rather keep the instructions as simple as possible. As they are, they're already too complex for many people to follow. Advanced functionality could be implemented by advanced users.
    #1677 fluffy 01/12/2004 11:45 pm
    BTW, even if you do implement that post-on-redirect hack, you'll still end up with lots of empty threads, and they'll all come when Googlebot indexes your site. At least if it's created by normal user browsing, it won't hit your db server all at once.
    #2753 NLE (unregistered) 06/19/2004 04:41 am
    Can I import past comments from MT?
    #2754 fluffy 06/19/2004 09:58 am
    It's possible, but I haven't written any code for doing that. I prefer to just use the MT comment display functions for old comments, personally, especially since phpBB anonymous comments don't have a URL field, so it'd have to be injected into the comment text itself.

    MT comments migrated to phpBB would be useful in terms of the stuff you could then do with them, but if you want to do that you'd have to do it yourself. Very Happy

    The way I'd go about doing it is something like making a special index template which just poots out code with something like (note: this is rather incomplete)

    <? $thread = <MTInclude module="GetForum">; ?>
    <? /* whatever the syntax is for posting a reply to a thread, using "<MTCommentAuthor>" as the username, and "<MTCommentBody escape="qq">" for the post text*/ ?>

    and then build this page and view it *exactly* once (delete it afterwards).

    You'll also then want to disable the MT comment display so that the comments aren't duplicated.

    Also, dealing with comment post times is a pain as well since you'll have to convert dates between a few different formats (MT doesn't provide a reasonable date format which PHP can understand off the bat) and you'll need to make sure that the initial post time of the phpBB thread comes before the individual comment's times, or else the sort order will be messed up since for some reason, phpBB and phpbb_fetch_all both sort the comment listing by date rather than just using the inherent strict ordering of post ID, which can also lead to some pretty wacky behavior since it's possible for a reply to display before the comment it's replying to, or even before the head of the thread, though at least phpBB doesn't treat the thread head as a special post (unlike some forum software like UBB).

    So, short answer: Yes, it's possible, but I don't recommend it. Smile
    #3272 Anonymous 08/07/2004 08:04 am Crosspost Certain Categories?
    I'd like to use this mod with my students since MT doesn't have an internal registration option. TypeKey is okay, but doesn't offer me the kind of control I'd like to modify the member profile. For example, I want to be able to post grades through the individual student/user private profile.

    Anyway, there are three kinds of posts for two classes -- 101 Journals, 101 Discussion, 101 Announcements and 102 Journals, 102 Discussion and 102 Announcements. I'd like these to go into separate forums for student commenting.

    Is is possible to customize the mod so it crossposts from certain categories?

    Professor K
    professor at kosub dot org
    #3276 fluffy 08/07/2004 06:24 pm
    As far as I know, this still works with MT3. This code doesn't actually touch MT itself, so as long as MT3 can still generate static pages (which I think it does) this code should work just fine with it with no modification, assuming they've kept the various template tags the same.

    As far as doing what you want, it's a little difficult, but not too bad if you know slightly-less-basic PHP than what you need to know to install this stuff to begin with. The basic idea is on the pages which use the GetForum module (so in your individual archive template, or in the file or whatever) you'd have this somewhere before the actual <MTInclude module="GetForum">:

    $CategoryMap = array(
        '101 Journals' => 5,
        '101 Discussion' => 6,
        '101 Announcements' => 7

    where for each array entry, the first bit (before the =>) is the MT category name, and the second bit is the corresponding forum ID. Then you'd change the FORUM_ID in your GetForum module to be


    instead of the single forum. Though this won't do any error checking of its own, so phpBB will probably complain loudly if you misspell the category name. Smile (Also note that the category name will be case-sensitive if you do it like this.)

    Since phpBB uses globally-unique topic and post IDs and all of the other code just works with those (and doesn't care about the forum), no other changes are necessary (e.g. to the thread display code or whatever).

    I hope this helps.
    #3884 navegante 11/12/2004 10:22 am
    Sorry for a dumb question, but iīm tented to try this script.
    Canīt i just use .html files parsed as php by the apache server avoiding missing files ?

    RemoveHandler .html .htm
    AddType application/x-httpd-php .php .htm .html
    I already have two php powerful scripts running that were only .php files...
    #3885 fluffy 11/12/2004 10:48 am
    That *should* be fine, yeah.
    #4430 Tim (unregistered) 02/03/2005 01:32 pm
    Have you ever tried integrating a second weblog into this system? I am looking at creating a second weblog on the same server (and thus the same installation of MT) and would like to have the same functionality with comments going to the same installation of phpbb but into a second forum. Any idea if that is possible?
    #4431 fluffy 02/03/2005 01:43 pm
    I don't see why not. All you should have to do is just have the second weblog use a different forum ID, and use a different key for the thread source in GetForum (like "mt2_<$MTEntryID$>").
    #5442 FiReaNG3L (unregistered) 05/08/2005 11:48 am

    phpBB2 got released; do you think that your system is compatible with it?

    I also noticed that some people expressed interest for compatibility with dynamic publishing; do you have the intention to check into it?

    It's really a GREAT system, it should replace MT default comment system, in my opinion. Keep up the good work Smile
    #5444 dusk 05/08/2005 12:13 pm
    Um, this IS for phpBB2, which was released years and years ago. The original phpBB is beyond obsolete.
    #5445 FiReaNG3L (unregistered) 05/08/2005 03:14 pm
    Hint : Never post when you just woke up. Its a minor update... for some reason I thought it was phpBB3 or something. My bad Smile
    #5468 Michael (unregistered) 05/12/2005 08:40 am
    It seems to me that this solution didn't avoid the spamming that occurred on 5/10.

    Is there a way to set it up so that phpbb allows unregistered users to post, but they have to type in the graphical code (with the random numbers and letters)?
    #5471 fluffy 05/13/2005 01:35 am
    Oops, I didn't even notice the spamming. Grr, I need to pay more attention to my forum.

    The person who has been occasionally posting spam has been posting manually, and coming specifically to this entry for some reason (it seems to be on some sort of manual spam list that this idiot from Poland thinks is a suitable target). Adding a CAPTCHA wouldn't do anything to stop them. I don't want to make comment posting registration-only, but I'm getting pretty close to that point... Meh.

    It's only one person and every time they do it I add their IP address to a ban list which keeps them away for another few days. Anyway, I just added their ISP's entire IP block to the blacklist, so that should stop this particular spammer once and for all. I've also done a few things to prevent other spammers from even finding my weblog as a potential spam target (like redirecting them elsewhere if they show up from certain search phrases and so on).
    #5473 fluffy 05/13/2005 01:59 am
    I've cleaned up the thread again, which is why it's suddenly gotten shorter. I've also put a running catalog of the swept topics at the very top of the thread.
    #5766 WDuluoz 06/09/2005 02:46 pm Wordpress and Fluffy's wonderful script
    Let me first thank you for the script and tutorial. I used it on my website with great success. I wish I knew more about php, or I probably could figure this problem out.

    I am trying to convert your script to work with Wordpress. I have suceeded in bypassing all the function errors (wordpress and phpbb share function names) and have the script working for the most part. I have only change the script within the module to pull the information out of Wordpress, but I am getting a preg() empty error which corresponds to line 118 and 98 in the functions_post.php file of phpbb. I realize this may be out of your realm, but I hope you could point me in the right direction.

    I have the system pulling the values from the SQL database for Wordpress and then putting them into the GetMessage module (Im using a plugin instead).

    global $wp_query;
    $post = $wp_query->post;
    $id = $post->ID;
    $p_title = single_post_title();
    $link = get_permalink();
    $content = $post->post_content;
    echo "$content $link $p_title $id";//only to show the values.
    $thread_id = GetMessage("test_" . "$id", 21, 3, "$p_title", "$content", 0, 3, "$link");

    It correctly puts the information into the integrate table and begins making entries in the phpbb_post tables, but it doesnt put either the subject or the message.

    Within your script, you used MT(tag) encode="qq". Why did you? (This may be related to my problem.)

    Thanks for any help you can provide.

    #5767 fluffy 06/09/2005 03:24 pm
    I have no idea about Wordpress. You might want to look into using bbPress instead; it's a much nicer, more lightweight forum engine which is actually designed to be integrated into other systems (including Wordpress). Khazwossname uses it with a great deal of success, though he also uses bbPress as the weblog engine itself (and he's done a lot of major customizations to the code).

    Anyway, the reason for encode_php="qq" is just to tell MT that the message is going to be embedded into a double-quoted string. MT basically acts as an HTML preprocessor, and so when you insert a tag like <MTEntryText> it just enters the text verbatim; the encode_php="qq" turns all "s into \"s. So if your entry looks like:
    I had a lot of "fun" today.

    then the resulting code would be something like
    GetMessage(blah blah blah, "I had a lot of \"fun\" today.");

    Since you already have the entry text in a PHP variable there is no need to do any additional encoding. There's also no need to put it into quotes; just do e.g.
    $thread_id = GetMessage("test_$id", 21, 3, $p_title, $content, 0, 3, $link);

    I don't think that has anything to do with the problem you're having, though ("$foo" and $foo are functionally equivalent, though the first one's a little bit slower and takes more memory to execute).

    Also, GetMessage has to be a module in MovableType because MT just emits static pages; it's not a real function that's getting called, and all the variables etc. need to be pre-filled when the page is emitted. It's more or less irrelevant to the discussion except that maybe you're doing something freaky in your WP "plugin" - all you need to do is call the GetMessage function in

    Another thing: you can speed things up a lot by using GetThread() instead of GetMessage(), and only calling GetMessage() if GetThread() fails. e.g. something like (assuming your WP code is already correct to begin with):

    global $wp_query;
    $post = $wp_query->post;
    $id = "test_" . $post->ID;
    if (!($thread_id = GetThread($id))) {
        $thread_id = GetMessage($id, 21, 3, single_post_title(),
               $post->post_content, 0, 3, get_permalink();
    #5987 cride 07/11/2005 06:21 am A "how-to" to a generic CMS?
    Your script looks amazing. However, I'm stucked after "Get MT to create phpBB threads as needed.", because I'm running a custom weblog. If someone has ever written a more generic CMS, telling what functions/variables to call, please let us know.
    #5990 fluffy 07/11/2005 08:02 am
    There's just too many variables to write a single "how-to" for everything. But the basic thing you need to know is that you're going to have to somehow generate a call to the various functions in in order to create threads, and use phpbb_fetch_all to actually display them.

    Reading the documentation in and phpbb_fetch_all should be useful.
    #6125 Tim 07/31/2005 04:18 am
    I've been running this setup successfully for quite a while now. A week ago my host had some server trouble and I guess they had to restore a backup of both MT and phpbb. In that transition a few things got messed up. The one issue I haven't been able to solve is this:

    All the archived posts in MT show the correct conversation from phpbb. However, as soon as someone posts in one of those threads the former conversation is lost and a new topic is created in phpbb. And of course, that topic now only has one post in it.

    Any idea how I might be able to fix that?
    #6126 fluffy 07/31/2005 04:23 am
    Hm, that'd probably be a problem with phpBB itself... is the old thread still there in the forum itself? What's the thread's ID? (the t= parameter in the URL) Is there more than one entry in the phpbb_integrate table for an entry where the new threads have been created? (do 'select * from phpbb_integrate where source='mt_50;' from your SQL command line, for example)
    #6127 fluffy 07/31/2005 04:26 am
    I don't see why not. All you should have to do is just have the second weblog use a different forum ID, and use a different key for the thread source in GetForum (like "mt2_<$MTEntryID$>").

    By the way, if you're doing multiple weblogs from the same MT installation, it's not necessary to do anything special — MT already maintains global entry ID uniqueness. (I didn't know that when I wrote the message, since at the time I'd only ever used MT with a single weblog at once.)
    #6158 Tim 08/02/2005 07:47 am
    Thanks for the suggestions. As far as I can see everything looks normal.

    BTW, my site is at if you want to check it out and see if you notice anything out-of-whack.

    I'm doing some changes to the site and am a little worried that if I do a rebuild I'll somehow disconnect all those old topics from their forum entries (though I don't think that will happen).
    #6159 fluffy 08/02/2005 08:16 am
    It all looks like it's working fine to me. Could you point me to any threads where this new-topic behavior occurred?

    A site rebuild won't affect anything on the phpBB side. The link is based only on the MT entry ID, which never changes.
    #6162 Tim 08/03/2005 12:25 pm
    It all looks like it's working fine to me. Could you point me to any threads where this new-topic behavior occurred?

    A site rebuild won't affect anything on the phpBB side. The link is based only on the MT entry ID, which never changes.

    It seems to have resolved itself. That's odd, but I'm not going to complain. I had to clean up a few older entries, but other than that it's good to go.

    Hey, I'd love to implement pagination, especially for those threads where there are a couple hundred comments. Could you give me some tips (remembering I'm not so good with this PHP stuff) about how I might do that?
    #6163 fluffy 08/03/2005 03:59 pm
    The straightforward way is to just change your ThreadDisplay loop to something like for ($i = 1 + $_GET["start"]; $i < $_GET["start"] + 20 && $i < count($posts); $i++), and then after the main thread loop add things to the bottom of the page to go to ?start=0, ?start=10, etc. up to the size of the thread, with code like:

    $page = 1;
    for ($i = 1; $i < count($posts); $i += 10) {
        echo '<a href="?start=' . $i . '">[' . ($page++) . ']</a> ';

    Also, phpbb_fetch_all already has some functions built-in to deal with pagination but I've never gotten them to work very well (though I haven't tried much, since I"m not a fan of pagination, and instead prefer to just clean up threads or divert them over to the forum proper).
    #6164 dusk 08/03/2005 07:15 pm
    There's also a wonderful phpBB function called generate_pagination that'll do a lot of the work of generating a "1 2 3 ... 343 344 345 346 347 ... 567 568" style pagination thingamabob.

    Here's a bit where I used it in another custom module:

     $pagination = generate_pagination("module.$phpEx?xyzzy", $total_logs, $per_page, $start) . ' ';

            'PAGINATION' => $pagination,
            'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page )
     + 1 ), ceil( $total_logs / $per_page )),

    which would put said "pagination thingamabob" in {PAGINATION} and a page number in {PAGE_NUMBER}
    #6247 Tim 08/22/2005 11:34 am
    I'm giving up on the pagination! I just haven't been able to make it work. If anyone out there has and wouldn't mind sharing code, I'd love to get it going.

    Has anyone tried this system with MT 3.2? It looks like the new version will be ready any day now. I presume it won't hurt anything...
    #6248 fluffy 08/22/2005 01:45 pm
    Dunno about 3.2, but it's running fine on 3.0 on this site. I doubt they'd have changed anything that would break it in 3.2.
    #6291 Tim 08/25/2005 11:42 am
    Dunno about 3.2, but it's running fine on 3.0 on this site. I doubt they'd have changed anything that would break it in 3.2.

    3.2 has been released. Who wants to try it first? It looks like a major update...
    #6292 fluffy 08/25/2005 12:36 pm
    I'm upgrading it right now.

    Of course, I won't know if that's successful until it's done and I make a new entry, since right now it's just static PHP pages which happened to be generated by MT.

    It's worth mentioning that most of 3.2's new features are still just stuff that this integration stuff has provided for a couple years now. Smile
    #6293 Tim 08/25/2005 12:39 pm
    I'm upgrading it right now.

    Of course, I won't know if that's successful until it's done and I make a new entry, since right now it's just static PHP pages which happened to be generated by MT.

    It's worth mentioning that most of 3.2's new features are still just stuff that this integration stuff has provided for a couple years now. Smile

    I'll look forward to hearing about your success. The only feature I really care about is Trackback moderation. The rest is pretty disappointing IMO - especially the fact that they still have no media manager to list the graphics I've uploaded...
    #6296 fluffy 08/25/2005 12:41 pm
    That was the easiest MT upgrade ever.

    Aside from having to remove their index.html. Someday I need to get around to moving my weblog content to a directory other than the MT installation directory. What a major PITA, though...
    #6297 Tim 08/25/2005 12:50 pm
    That was the easiest MT upgrade ever.

    Aside from having to remove their index.html. Someday I need to get around to moving my weblog content to a directory other than the MT installation directory. What a major PITA, though...

    And everything still works, does it? I was a little concerned about how they'd handle the old-style archive links (ie postnumber.php rather than month/date/year.php
    #6298 fluffy 08/25/2005 02:23 pm
    Oh, they made that change back in 3.0. There's a compatability option for still using the old postnumber things. (That change was why I took so long to upgrade to 3.0, but it turned out to be a non-issue.)
    #6299 Tim 08/25/2005 04:04 pm
    Oh, they made that change back in 3.0. There's a compatability option for still using the old postnumber things. (That change was why I took so long to upgrade to 3.0, but it turned out to be a non-issue.)

    So is there any reason not to go ahead and upgrade ASAP?
    #6300 Tim 08/25/2005 04:15 pm
    One more quick question.

    How do I mimic the "Reply" you have on your individual entry archive above each post?


    How do I have phpbb return to the individual entry archive instead of defaulting into the forum thread after someone posts?
    #6301 fluffy 08/25/2005 05:01 pm
    1. See
    2. Someday I'll get around to releasing my mod for that, but it requires a pretty invasive set of changes to posting.php. But it's what the 'url' column in phpbb_integrate is for.
    #6523 Tim 10/10/2005 10:38 am
    Yet another question for you:

    I currently use this setup with three different blogs within one install of Movabletype. I'm wondering if there is a way of listing the last X threads that have been commented on and have it pull not only from one forum but from any of the three that use this system. So rather than having 3 lists of updated comments I'd have only one. Is that possible? If so, can you let me know how? Smile
    #6524 fluffy 10/10/2005 11:05 am
    In RecentDiscussion(), change the 'WHERE' clause to include all the different fora. For example, 'WHERE (t.forum_id=5 OR t.forum_id=12 OR t.forum_id=17) AND (t.topic_replies ...'
    #6526 Tim 10/10/2005 11:24 am
    OK, but don't I need to provide a different way of sending people to each of the different threads? The path to each forum is in the $link variable - wouldn't I have to drop an "if" statement in there, or something, to send people to the correct link?

    $link = sprintf("", substr($row['source'], 3));
    #6527 fluffy 10/10/2005 12:01 pm
    You're quoting from an old version of the RecentDiscussion() function - the current version of everything just stuffs the URL directly into the phpbb_integrate table (in the 'url' column). As long as you're using the latest version of you don't need to worry about that, as you can just use $row['url'].
    #6537 Tim 10/12/2005 11:18 am
    You're quoting from an old version of the RecentDiscussion() function - the current version of everything just stuffs the URL directly into the phpbb_integrate table (in the 'url' column). As long as you're using the latest version of you don't need to worry about that, as you can just use $row['url'].

    So should I go ahead and move to the latest verison of, or might that mess things up? If I move to the latest version of and use the new RecentDiscussion() will everything still work?
    #6538 fluffy 10/12/2005 12:09 pm
    It'll be fine as long as you add the 'url' column. I thought I had posted upgrade instructions around here but I can't find them. It's just:
    ALTER TABLE phpbb_integrate ADD COLUMN url varchar(255);

    It'll take a while (meaning, until the next search engine crawl) for all of the updated URL values to propagate into the table, but you can force the issue by just running all of your MT pages directly with something like:

    cd /path/to/weblog/archives
    ls *.php | xargs -n 1 php

    It's pretty moot, though, since typically if someone posts a comment to an entry it'll be because they've viewed the page and thus have updated the URL column. (Convenient.)
    #6539 lunacy8m 10/12/2005 04:43 pm
    I've been using this commenting system for over a year now, and it's great! However I recently switched hosting companies, and now find that I am getting an error when calling the CommentLink module:

    <!-- query SELECT * FROM phpbb_integrate WHERE source = 'mt_1111' LIMIT 1 failed -->

    This is also happening on the individual pages:

    <!-- query SELECT * FROM phpbb_integrate WHERE source = 'mt_1111' LIMIT 1 failed -->Could not obtain userdata from user table on /home/gadget/public_html/phpbb/, SELECT * FROM phpbb_users WHERE user_id = 3

    I've checked my config.php for phpBB which is correct, and I've checked the user 3 and he is active. This error happened when I switched from one host to another, nothing changed in the code. I'm about to tear my hair out - your help figuring this out is greatly appreciated!
    #6540 fluffy 10/12/2005 04:47 pm
    Did you remember to move the phpbb_integrate table over?
    #6541 fluffy 10/12/2005 04:49 pm
    Oh, also, is the forum itself working? The "could not obtain userdata" message raises a red flag for me.
    #6542 lunacy8m 10/12/2005 04:51 pm
    Did you remember to move the phpbb_integrate table over?

    I did a full mysql dump/restore of the entire phpbb database when I moved, and the integrate table is there. I just double-checked and the query works from phpMyAdmin, but not when called from CommentsLink.
    #6543 lunacy8m 10/12/2005 04:52 pm
    Oh, also, is the forum itself working? The "could not obtain userdata" message raises a red flag for me.

    That's the baffling part - the forum is working fine! Here is the link.
    #6544 fluffy 10/12/2005 05:21 pm
    Hm, dunno. I can give it a bit more attention when I get home from work.
    #6545 lunacy8m 10/12/2005 05:23 pm
    Hm, dunno. I can give it a bit more attention when I get home from work.

    I really, really appreciate the help. This link might also be useful. Thanks!
    #6546 fluffy 10/12/2005 05:58 pm
    You misspelled "xenomorphic." HTH.

    #6547 lunacy8m 10/12/2005 06:01 pm
    You misspelled "xenomorphic." HTH.


    On purpose - for SEO. Very Happy Thanks for your time, I am at my wits end. I've spent the last 24 hours trying to get this to work and am not having any luck.
    #6548 fluffy 10/12/2005 07:02 pm
    Okay, my only guess would be that your host is restricting access to the phpbb database from a few specific scripts, probably for security reasons, since from what I can see, phpBB functions being called from aren't seeing the database *at all*. Talk to your webhost to see if they have any sort of special SQL permission layer in place.
    #6549 lunacy8m 10/12/2005 08:08 pm
    Ok, I asked them to check my dedicated server and they cannot find anything in place that would be blocking it from running. Interestingly enough though, all the phpbb_fetch_all example scripts seem to work just fine - here's a link. While I am waiting on them to follow up, any idea why these phpbb_fetch_all scripts would work and the would not? Seems odd that it worked on my old dedicated server and now not at all on the new one, odder still that the fetchall examples seem to work alright.
    #6550 fluffy 10/12/2005 08:14 pm
    No idea. Check the permissions on, maybe? php (or its SQL layer) might have something weird going on if the permissions are anything other than 644.
    #6551 lunacy8m 10/12/2005 08:17 pm
    Confirmed, permissions were already set to 644.
    #6552 fluffy 10/12/2005 08:23 pm
    No freaking clue. Maybe something else higher up on the page is changing the value of $db or is closing the database connection?
    #6553 lunacy8m 10/12/2005 08:49 pm
    Shouldn't be - worked fine for almost a year on my other server. But I will put together a test page with minimal content to test. I'll give you an update on this tomorrow am. Thanks again for looking.
    #6556 lunacy8m 10/13/2005 07:55 am
    One question, does your script rely on mySQL 4.1? The only difference the hosting company can find is that on the old server 4.1 was being used, and the server that it does not work on is running 4.0.
    #6557 fluffy 10/13/2005 08:11 am
    It shouldn't. It just uses phpBB's database access layer, and there's nothing fancy in the queries.
    #6566 lunacy8m 10/15/2005 12:27 pm
    It shouldn't. It just uses phpBB's database access layer, and there's nothing fancy in the queries.

    Ok, here is where I am at. Finally got it to connect to the database by adding the following to

    include_once($phpbb_root_path . '');
    include_once($phpbb_root_path . 'common.'.$phpEx);
    include_once($phpbb_root_path . 'mods/netclectic/includes/functions_insert_post.'.$phpEx);

    //added by mike
    global $db;
    #$db = $db->db_connect_id;
    mysql_select_db("gadget_phpbb", $db->db_connect_id);

    //end add

    /***** Configuration *****/

    Apparently my ad server software uses the same connection name, so it was connecting to the wrong database.

    Now I have a seperate issue where threads are being created multiple times. Here is the link.

    I have no idea why this is happening. Any chance I could hire you for an hour to help me get this sorted out? I'm sure if you could look at it you'd be able to sort it out far more quickly than I.
    #6567 fluffy 10/15/2005 12:31 pm
    If threads are being created multiple times, then GetThread() is failing to work correctly. Make sure that the right stuff is getting passed in. Try adding debugging statements everywhere for example.

    Also, look at the phpbb_integrate table to see if all those threads are being registered to the same source key.
    #6948 Tim 01/16/2006 12:34 pm
    My server seems to have gotten sufficiently busy that I can no longer make this work. The server was getting crushed and my host told me to cut phpbb as my commenting or to go elsewhere.

    So...I'm transitioning back to MT's commenting (blech) but would like to preserve the 16 months worth of comments in phpbb. Is there a way I can integrate those into my MT individual templates without much overhead?
    #6949 fluffy 01/16/2006 07:53 pm
    Blah, phpBB has scaling issues? That's unfortunate.

    Porting the comments back to MT would be pretty difficult, but one stopgap thing you could do is just statically emit all of your comment threads into include files by making DisplayThread() see if, say, exists, and if so, include()ing it, and if not, poot all the comments into that. (For extra cool points you could also have it delete that .inc file if a comment gets posted to the thread so the comments just get pseudo-statically generated, MT-style, though that would probably involve hacking on phpBB itself.)

    Maybe I'll write a caching layer for phpbb_integrate to help sites scale anyway.
    #6950 fluffy 01/16/2006 11:06 pm
    If I do it'll take me a few days to get around to it (it's a bit more complicated than just pooting the thread display into a file, what with the various permissions stuff for the command buttons and so on).
    #8979 santosh_iit32 04/17/2007 06:49 am
    i wish somebody could help with the integration of phpnews with phpbb

    link to the phpnews:
    #8980 fluffy 04/17/2007 08:09 am
    The main problem which you usually run across when trying to integrate two PHP-based systems together is they often use the same global variable names for things like database connections. One hackish way to deal with this is to just put both systems' databases into the same database space (i.e. don't separate your apps into different databases), though that only partially addresses things.

    Another way is to separate the comment stuff out into an internal stub which is just @included via HTTP, though then you lose the ability to use the phpBB login information from the calling app. Or you can do the @include AJAX-style but then you lose the ability to get comments indexed by Google and your site read by people running non-AJAX-compatible browsers.

    These issues are a big part of why I don't like PHP as a language. There's no easy way to just namespace stuff or sequester it away. An app needs to be written specifically to be embeddable as a library, and basically no PHP apps are embeddable.

    The reason phpBB and MT get along so well is that they don't know anything about each other; MT just emits HTML as far as it cares, and then that HTML happens to include the php necessary to embed phpBB. So they're completely separate.

    An okay long-term solution is to just make a version of the phpBB libraries which are explicitly embeddable, and which basically just share a db schema with phpBB. However that's a huge amount of work, and would be extremely fragile. So the best long-term solution is to just make an embeddable commenting library and then build a forum around THAT. This is something I've thought a lot about on and off but of course I don't really have the time/energy to do that, especially since phpBB still suits my needs more or less these days.
    #8987 asuh 04/17/2007 11:10 pm
    Hey fluffy, long time.

    I've loved your implementation of this integration and have been quite a fan. But, now that movable type's commenting system has developed, I'm tempted to go back for several reasons.

      The MT-Blacklist is much more efficient at blocking comment spam than it used to be.

      There are further solutions for fighting spam such as akismet that can be plugged into the commenting system.

      With the default form system, it's pretty easy to let users interact with your blog compared to making them sign in to phpBB. I also enjoy the ease of use it provides.

    I'm aware that all three of these and others are pretty much possible on phpBB as well, but I also see an unsure future for phpBB as the next version, 3.0, has taken years to develop and I'm not how modern the code will be (meaning standards compliant, accessible, usable, etc). I do, however, really enjoy the way phpBB easily handles the comments and all the expandability that this system provides for the comments.

    You're a god for writing this and releasing it to the public, but I'm curious to know your opinion concerning someone in my position (of which I'm sure there are probably others). Thanks again for all your hard work!
    #8988 fluffy 04/17/2007 11:17 pm
    Well, I use MT's built-in comment engine on a few of my sites and it still gets a LOT of spam. Blacklisting can only do so much, and the various spam-trapping heuristics are still much more effective. I very rarely get spam comments on my weblog (which has way more pagerank than the other sites) but get a huge amount of spam to the other sites. So far those sites don't get a lot of comments, though (I think I've gotten five legitimate comments total combined, and three of them were mine), so it's hard to tell if it's just decrepit-site syndrome or what.

    phpBB 3.0 does seem to have some major problems in that as hard as it was to integrate 2.x with other sites, 3.0 has gone even MORE overcomplex and less embeddable. I haven't evaluated the code directly though; it's possible that it might be cleaner and more modular (I hope it is, anyway, since 2.x's code is terrible) and hopefully some of the long-standing problems with it (a glut of copy-paste code instead of modular functions, way too many global variables with bizarre side-effects, etc.) have been addressed.

    Also, note that with decent anti-spam mods, you can safely allow anon comments on phpBB. I've been allowing anon posting (of replies, rather than new threads) on my forum for a few months now and haven't had a lot of trouble with spam as a result.

    I mean, far be it from me to defend phpBB or anything - frankly it sucks a LOT and the only reason I even went with it was that it sucked less than the other forums available at the time - but I don't think MT's comment engine is a step in the right direction. In particular, it ties comments specifically to entries, and MT's own entry model leaves a lot to be desired as well.

    A much better system would be an embeddable comment engine which is designed specifically to work within other things as well as on its own, and which allows pluggable identity modules (TypeKey and OpenID themselves are good starts but they still need better admin-level control, no to mention the lack of real uptake so far).

    The big thing for me is that with my phpBB hacks I can do a lot more flexibility regarding actual forum use, e.g. friends-only entries and reply tracking and so on. I see reply tracking as the big killer app for any comment engine, too; sure, WordPress and MT support per-entry comment RSS feeds but managing subscriptions to those is a huge pain in the ass with the current state of RSS readers. I do have ideas on how a browser could provide a seamless, transparent subscription-discovery mechanism to the end user which would Just Work but it'd require support from the browser itself (though it could be done as e.g. a Firefox mod or a SIMBL plugin for Safari or something).
    #9560 asuh 07/31/2007 02:09 am
    I was doing some maintenance and found a little bug that I'm not sure if it's just me or the way my script is written. When I try to log out from within my individual archive page, it takes me to the phpBB forums and comes back with "Invalid_session".

    When I log out from within phpBB, it's just fine. The only difference I can see is that there's a redirect on the anchor link in the post whereas there's not one in the forum itself. However, my is probably two or more years old so I'm not confident that it's functioning right.
    #9561 fluffy 07/31/2007 07:35 am
    Weird. Try removing the append_sid() around the logout link?
    #9568 asuh 07/31/2007 10:48 am
    darn, didn't work.
    #9569 fluffy 07/31/2007 01:09 pm
    No idea. phpBB's session stuff can be weird in places. Try updating the logout link to use the code from the latest version I guess. I don't know if I've changed anything in that in a while or whatever.
    #9570 fluffy 07/31/2007 01:11 pm
    It doesn't look like that's changed any though. Try just deleting everything from your session table and see if that fixes it (everyone will have to log in again).
    #9571 asuh 07/31/2007 01:19 pm
    remind me, is that the phpbb_sessions row in the database that I just empty? I see that row and phpbb_sessions_keys in phpmyadmin. i shouldn't empty both of those, right?

    Nevermind, I went ahead and emptied the phpbb_sessions after a little research. I'm not sure if this is true but when I try to log out and there's no sid attached to the end of the page name, it gives me that invalid_session problem. Right now, even though I'm logged in on my site, none of the log out links have sids attached.
    #9572 fluffy 07/31/2007 04:14 pm
    If the session is dead then you shouldn't be logged in. Try also killing sessions_keys? I don't know.
    #9579 asuh 08/02/2007 02:41 pm
    I've asked for some advice on phpBB, and here's the thread of what has been discussed.

    It's basically to replaced some of the append_sid with sid=$userdata['session_id'], but I'm not sure why that's different and how it'll make a difference? What do you think?
    #9580 fluffy 08/02/2007 03:13 pm
    I think phpBB is a piece of shit.
    #9581 asuh 08/02/2007 03:15 pm
    hahahaha... sounds like you don't wanna be bothered with this anymore. sorry for buggin' ya but thanks for your suggestions!
    #10293 asuh 01/01/2008 10:06 pm
    Not to beat a dead horse, but the last quarter of the year has seen two major developments with both systems this project involves: movabletype 4 and phpbb 3. Do you have any interest or plans to upgrade your integration into both of these platforms?
    #10294 fluffy 01/01/2008 10:09 pm
    I am very unlikely to ever update to phpBB3 since they took it in a direction pretty much the opposite of what needed to happen, and getting things to work will probably be difficult.

    In theory, there shouldn't be any trouble getting things to work with MT4 though, unless they've done something silly like require all pages to be generated dynamically or whatever.
    #10295 asuh 01/01/2008 10:14 pm
    i'm currently evaluating which direction to go with my commenting system and whether i should go with MT4's system or figure out what to do with the current phpBB system. I haven't given phpBB 3 much of a look. I just want a robust system and I'm not sure if phpBB is the solution I need anymore. What are your thoughts?
    #10296 fluffy 01/01/2008 10:17 pm
    I basically don't really care about this stuff anymore anyway. MT For Communities looks pretty interesting, and there's a lot of turnkey social network platforms out there which seem to be pretty okay for community purposes. For now I'm fine with just letting my current hacked-up solution limp along.
    #10297 asuh 01/01/2008 10:24 pm
    yeah, i gathered that a few months ago. It was nice while it lasted. I'm sure there's no easy way to export all that information from phpBB back into moveabletype. I'll have to check out the MTCS further to see how it works.