I found it interesting to read that phpBB is participating in the Google Summer of Code this year. One of the features that they hope to get out of the process is a post revision history… something that I started designing years ago, and will be releasing into production on my largest board within the next few weeks! Great minds thinking alike and all of that…
Turns out that in this case, phpBB2 was probably easier to work with than phpBB3. With phpBB2 the post text is already separated from most of the other post meta data (such as poster, poster IP address, and so on) which made it very easy to design a way to track post revisions. In phpBB3 they combined the phpbb_posts and phpbb_posts_text tables into a single table. In order to track post revisions in that case, the design would call for splitting the text out into a separate table in order to track the post text revisions without having to duplicate all of the other post meta data.
In any case, I have finished the coding and testing for everything and it’s functional. What’s left is going back and adding in some security checks to make sure people can’t do things they’re not supposed to do…
I’ve seen several phpBB boards over the years that swap out the regular graphic objects for holiday objects at certain times of the year. At phpbb.com they have previously done this for Halloween as well as the year-end holidays. I’ve done the same thing for my biggest board “BOB” by replacing the regular logo:
with one of several holiday logos:
And of course this:
During the American Thanksgiving week we used this:
Over at the phpBB2 Refugees site we’ve swapped our normal refugee tent for one with a more holiday feel for the last several weeks:
Right now this is a manual process, which means I have to remember to edit the php code to invoke the new logo (or alternately use ftp to upload a replacement logo with the same name over the current one). Manual process? for Dave?
I’m setting up a database table with dates and alternate logo names, and will set up a cron job that every night at midnight checks to see if holiday logos are needed for the following day or not. On BOB we rotate among several logos, so there could be more than one logo at any given time. The logo information is then written to a cache file where it will be used for the following 24 hours.
Easy as pie.
emoticon() function and now it’s calling
insert_text() just like the BBCode insertion process.
I used the same function to update my canned messages MOD as well.
Oh, and I updated the color picker just a bit. The original color picker used values of 00, 40, 80, and two more to create an array of colors that was 5×5x5. I changed it to the old “Netscape Safe” color palette and used 00, 33, 66, 99, CC, and FF and created a 6×6x6 grid instead.
I have the new posting form activated on two different boards for the moment. As long as I don’t find too many issues I will write it up as a MOD.
As I was working through some code last night I found another “in progress” MOD that I wanted to add to the list of MODs in progress that I published yesterday. Over the years I’ve seen cases where someone from the other side of the planet has a dicey Internet connection and they end up submitting the same post twice because their browser submit times out. Or someone might post the same question in more than one forum, thinking that they’ll get more attention. Or a spammer might hit multiple forums with the same post multiple times.
I think I’ve managed to come up with something that definitely helps solve the first two scenarios and as a bonus helps the spammer problem as well. I call this my “Cross Post / Double Post” MOD, and it’s being tested on my beta board now.
The MOD design has so far turned out to be fairly simple. I tie into the flood control process and retrieve the post text for the last three posts by the user. From there I take the current post text and compare it to the prior posts. The first check is a straight equality check, meaning I check for the exact same post text. This will catch the “copy/paste” folks with very little overhead. If the post text is not identical, then next I use a function called
similar_text(). (similar text reference at php.net) This function takes three arguments. The first two are the two strings to compare, and the third is a variable to store the results of the comparison, which is a number from 0 to 100. The result code should essentially be treated as a percentage. If the two posts are 95% similar then I check to see if the original post already in the database is in the same forum as the new post being attempted. If the forums are the same, then a “Double post” exception is triggered. If the forums are different, then a “Cross post” exception is triggered instead.
The number of posts (3) and percentage of similarity (95) are both controlled via the board configuration screen, so it’s quite flexible. Setting the percentage threshold to zero (0) is the same as turning the comparison process off.
This MOD is being tested on my “beta release” board right now. The first version of the MOD did not use the
similar_text() function mentioned above. I attempted to use the
soundex() function instead. However it seemed that the
soundex() function did not look at enough text, so posts that were clearly different were still being reported as being the same. Switching functions solved that issue.
I’m now wondering if I need to deal with setting different threshold values for different forums. I hate to do that, as it drastically increases the complexity of the code. But for example there are many forum “games” that people play in an “off topic” type of forum. Some of those games look very repetitive, and would potentially trigger the CP/DP exception handling. Then again, the current logic looks across all forums, so as long as the person is active in more areas than just the off-topic games area it might be okay. I don’t want this feature to get in the way of normal use, but I do want to help out the moderator team by capturing / rejecting double post and cross post events.
Stay tuned for details as we start user testing this week.
What has Dave been working on lately? Not blog posts, obviously. Here are the headlines…
- Full-Text Search
I created a full-text index on the post subject and text over a year ago to see if maintaining that index would cause any performance issues. I’m happy to say that I have not seen any challenges from inserts / updates with this index in place. I’m going to be altering the search screen to allow the full syntax offered by MySQL on this type of index and hope to release that in a few months. Some of the challenges I have not yet decided how to solve are things like limiting forums – either by security or user preference – and other criteria that can be entered on the standard search screen.
- Capture Post Revisions
I’ve also added some code to capture post revisions. We’ve had a couple of folks that come back to our board and edit their post, removing all of the text and leaving only something like “…” instead. This destroys the continuity of the topic, and as a result we’re going to now track post revisions by capturing the post text history. If needed a moderator will be able to review and then restore a prior post, and ultimately lock that post from further editing. As with the full text search I have done fairly extensive testing on how this is implemented in order to ensure that performance does not suffer, and I’ll have a few blog posts about that process. This MOD is completed and I expect to roll it out onto the main board in a few weeks. (FWIW, I first talked about this post several years ago, and am just now finally getting it completed.)
- Moderator Posts
I’ve added a new field to the post table that allows a moderator to designate whether it’s a moderator post or a user post. For example, moderators can certainly participate in a normal board conversation as a regular person. But they may also add posts in their role as a moderator. This new feature will format those posts differently so they stand out, will automatically remove the “personal” aspects of a post such as signatures, and does not increment a moderator post count for this type of post. It is intended to be a way for moderators to be able to separate out their moderator posts from their board participation posts. This MOD is also completed and expected to be released shortly.
- Including External Content
I’ve added some cron jobs that parse RSS feeds from several blogs owned by board members. Their blog posts are automatically set up as part of their signature (as “Latest Blog Posts”) and updated once an hour. For bloggers that our community wants to recognize, this is a great way for them to get additional exposure without having to manually update their signature every time they publish a new blog post. This part of the MOD is already in use on our board. Only board admins can currently enter blogger information, as we want to go through a review process and certify blogs rather than allowing just anybody to link to an external site. This was done by altering the administrator user edit form and leaving the regular user profile form alone.
As an extension to this, I’m also pulling in the content from the blog post and storing that in a hidden forum. As the blog posts are added to the forum they are obviously added to the full-text index because they’re part of the same table. I am also adding these posts to the standard phpBB2 search tables at the same time. That way if someone searches for term “X” and that’s found in an external blog post, they’ll see a link in their search results. The blog address is stored on the topic table and a different icon is used to show the user that they’re leaving our board and heading to an external site. I have all of the main work done; the last requirement is altering search.php so that it offers the ability to include / exclude external content and then react to that setting accordingly. I hope to get this completed in the next few weeks.
- Social Media Profile Links
I’ve added Facebook, Twitter, and LinkedIn fields to user profiles. These are displayed along with the other profile links, using smaller 18×18 pixel logos. I’m planning on going back and redoing the other profile links to use the same form factor but that part hasn’t been done yet. Here are the images I’ve made, using logos or other material provided by each service provider.
One thing that many of these MODs have in common is my concern for performance. We’re over 750K posts now, and still running extremely well on a server that is hosting several dozen sites, although none of them as active as our big board. Every time I touch the code performance is a primary goal. Another MOD that I’ve been planning is to port the phpBB3 posting form back to phpBB2 since it does a better job of supporting modern browsers as well as proving some additional formatting features. I haven’t even started on that yet, but I think it would be good. Now that I’ve personally switched to Chrome as my standard browser I’m noticing some interesting quirks.
So that’s what I’ve been up to for the past few months.
We have a topic on my board with the title “Please do not post in this topic”. Needless to say, this topic has survived for nearly three years, even in the “off topic” area where topics are pruned after 14 days of no activity. So lately I have been trying to have some fun with it.
To continue the fun, I am looking for suggestions for other ways to challenge folks, and keep them from posting in that one topic. The key is there has to be some sort of loophole, as I’m not trying to completely lock folks out.
phpBB3 includes a “report a post” feature that was often requested in phpBB2 and available as a variety of MODs. I wrote my own that integrates with other MODs that I have implemented. But one of the things that I did different (and that I prefer) is that I provide a visual indication when a post has been reported.
Just a few minutes ago I was on phpbb.com and saw a post in the General Discussion with the title “Is this new home page nice?” Anyone that has been around phpbb.com for a while knows that this sort of post – even in GD – is against the rules. I figured that someone might have reported it already, but there’s no indication that such an action was taken. I decided to go ahead and report the post.
When I clicked the proper icon, here’s the message I got:
This post has already been reported.
Well. If that’s the case, why not tell me? More…
I’ve seen this on other boards but only recently have I started seeing it on my own: people that edit the first post (or potentially even all of their posts) of a topic and remove all of the content. They might leave behind something like “…” because as we all know you can’t have a truly empty post. The net result is the topic is then worthless because nobody knows what we’re talking about.
With phpBB3 the moderator team can lock a post to prevent further editing. But once the original content is gone it doesn’t help. So tonight I started thinking about how and where to store post revisions in order to recover from this sort of action. More…
Anyone who has worked with database date/time fields probably recognizes the number from the title of this blog post. If not, it’s simple: there are 86400 seconds in a day. Why do I care about this? Because there are all sorts of fun things that I can do with that number. More…
While I have not started in-depth MODding on phpBB3 yet, I do read the phpBB3 MODders forum from time to time just to start to get the flavor of how things have changed. The other day a database (query) question came up and I suggested an answer that I originally thought was only slightly different from what had already been proposed. However, after being asked which of the two solutions would be the least CPU intensive I did a bit more investigating.
I discovered that one solution was clearly better than the other, but only if the proper index was created.
Disclaimer: I tested on phpBB2. The index that I created does not exist in a standard phpBB2, nor does it exist in a standard phpBB3 install, so I suspect this post applies to both. More…