Integrating your phpBB topics and posts into WordPress … or any web page!

As some know, I am the developer of phpBB’s Smartfeed extension. This extension provides an ATOM, RSS1 or RSS2 feed of posts and topics on your website.

These feeds allow people to read posts on the forum remotely using a newsreader application, like one built into MS Outlook or using feed aggregator sites like feedly.com. The main advantage of feeds is that it allows you to read a forum without actually having to visit the site. If you regularly read lots of sites, using a newsreader is very efficient way to read content compared to actually visiting each site.

Smartfeed is not the only extension that does this. In fact, if you don’t need to support the RSS format and only want to show posts in public forums, an ATOM Feed has been built into phpBB since version 3.0.6. You might want to read the knowledge base article to learn the syntax to use. You can control your feeds in the Administration Control Panel: ACP > General tab > Board configuration > Feed settings.

Sometimes you want to highlight recent topics and posts on your larger website, or on another domain. For example, you may have a phpBB forum in a folder on a WordPress site. You might want to use a WordPress widget to highlight current topics and posts on a sidebar of your WordPress site. The links in the sidebar will take people directly to the post or topic of interest.

I will demonstrate how to do this using WordPress. However, conceptually you don’t need WordPress to do this. You just need something that can read an ATOM or RSS feed of your forum, and parse its XML into HTML for display, or write your own program to do this. For example, if you are familiar with jQuery, there are a number of jQuery feed plugins that would work. The PHP SimpleXML library is one way you can do it in PHP with a short PHP program.

Here’s one way to do it in WordPress:

  1. Spend some time figuring out what you want to highlight in WordPress: recent posts or recent topics. I will show a list of recent posts. In this example, I first installed my Smartfeed extension. This is because I got a SimplePie parser error when I used phpBB’s ATOM feed. This is due to a bug when parsing ISO dates in ATOM feeds using the SimplePie library. SimplePie is bundled with WordPress. I reported the bug. The resulting URLs for the feed can be seen if Smartfeed is installed. It is in the HTML source for the forum. I will use the second link because the ?y=2 parameter creates a RSS feed instead of an ATOM feed to avoid the SimplePie bug.
<link rel="alternate" type="application/atom+xml" title="ATOM" href="/phpbb/app.php/smartfeed/feed" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/phpbb/app.php/smartfeed/feed?y=2" />
  1. Note: if using Smartfeed, and you want a list of recent topics only, the resulting URL will look something like this. You should be logged out when using the Smartfeed interface. Note that you can refine the URL in the Smartfeed user interface. lp=1 limits the feed to the last post in the topic only, t=2 suppresses the time limit for retrieving posts, s=1 gives a standard sort from most recent to least recent, i=0 means to not require a minimum number of words in the post, y=2 forces a RSS2 feed, d=3 sets the feed style to use HTML, w=0 means not to limit the maximum number of words in the post, and tt=1 means to show topic titles only. There are lots of variations so use the Smartfeed interface to get the output just the way you like it.  
http://127.0.0.1/phpbb/app.php/smartfeed/feed?lp=1&t=2&s=1&i=0&y=2&d=3&w=0&tt=1
  1. Presumably you have installed WordPress already. If you haven’t, it can be downloaded from wordpress.org. Or you can usually install it from Plesk or cPanel.
  2. Login to WordPress as an administrator and go to the WordPress dashboard.
  3. WordPress comes with a RSS Widget preinstalled that also can handle ATOM feeds. You can find it off the dashboard: Appearance > Widgets
  4. Click on the RSS Widget then press the Add Widget button which appears, which by default appears on the sidebar.
  5. In the sidebar, click on the RSS Widget that was added. Enter the URL for the feed and give it an optional description. Note that it needs to be the full URL, not the partial one shown above. Then press Save.

    Configuring RSS Widget
    Configuring RSS Widget
  1. I dragged the widget to the top of the sidebar so it would appear first on the sidebar. Of course, you can place it anywhere on the sidebar that you like.
  2. Go to your WordPress site and find it on the sidebar.

    List of recent forum posts in the WordPress sidebar
    List of recent forum posts in the WordPress sidebar

Note that this works for any domain, providing the feed is publicly accessible. So you can promote this approach to have similar sites show your list of recent topics or posts. Note also that my Smartfeed extension has a number of options to make the post subject or topic title prettier if the default looks too wordy.

Smartfeed 3.0.8 ready for testing, supports 3.2 only

Version 3.0.8 of Smartfeed is now ready for download and testing. It addresses issues found in the latest review by the extensions review team. This version works on phpBB 3.2 only.

You can download it from GitHub or get the archive off my website.

A phpbb.com support topic is here.

Major changes:

  • Now uses AES-128-CBC encryption, a higher and much more secure encryption standard, for generating a hash of the user’s password. This means you must rerun the Smartfeed user interface to generate a new URL if you want to use the logged in features of Smartfeed. If you don’t you will get a Smartfeed error that will direct you to do this.
  • Supports phpBB 3.2 only

Bugs fixed:

  • phpBB’s generate_text_for_display() function can leave </ at the end of strings. This appears to be a bug and can cause feeds not to validate. If present I remove these characters.
  • When you specify the number of items in the feed, it includes private messages and external feed items (if any) in the count.
  • Attachment sizes shown in kilobytes use the language string
  • When a user is logged in, if the administrator has turned on the feature to require IP authentication, the user interface no longer shows a control allowing you to not use it
  • When a user sets the maximum number of items in a feed, it is not ignored.

Other changes:

  • <br /> tags replaced with <br> tags in templates. HTML 5 is not as picky as XHTML.
  • Removed the constant SMARTFEED_IV since the AEC-128-CBC algorithm needs a randomly generated IV
  • Removed redundant template variables
  • Changed criteria for identifying new posts and new topics. If either the post date or the topic date falls within the range of time wanted (such as 24 hours) it is identified as new. There is also a new language string that specifically identified new topics
  • The default language for the feed is based on the default board language, so it is not always en-gb anymore.
  • Migration program uses config.update() rather than a combination of config.remove() and config.add()
  • SimplePie library was upgraded to the current production release: 1.5
  • Smartfeed homepage URL now includes the www. prefix
  • User interface notes that styling in feed does not apply to items that are in external feeds.

Smartfeed 3.0.7 Released

Smartfeed 3.0.6 was not approved but the issues were quite minor. A review always takes time because there is a review queue, but in addition it took weeks before I could submit 3.0.6 because I had bundled SimplePie, and the library was so big that it couldn’t be uploaded. Eventually the webmaster fixed the problem and it could be reviewed.

Anyhow, 3.0.7 is now available. The only change in functionality is that Smartfeed no longer uses mcrypt (it is being deprecated) and uses openssl instead. openssl is almost always available so it will be a rare board that can’t support encrypted feeds.

Download here from GitHub or grab it off this site.

Here are a list of changes:

  • PHP’s openssl library is now used instead of mcrypt. As a result of the change, users may have to run the Smartfeed user interface to create a new URL. They will get a message in the feed to this effect if it occurs.
  • Fixed some links to use the helper class’s route method.
  • Replaced <br /> tags with <br> tags since HTML 5 is more flexible than XHTML which is no longer used.
  • Language strings use curly quotes.
  • Removed language variable that were no longer used.
  • Changed the URL to the Smartfeed page to prefix it with www.

Smartfeed 3.0.6 archive had unnecessary files in root folder

When I created the archive of Smartfeed 3.0.6, apparently some files that exist in folders were copied into the root folder. It didn’t hurt anything but it’s incorrect. I have republished the archive on this site. You might want to delete these files and reinstall it in /ext/phpbbservices/smartfeed.

Aside from this error there were no code changes.

It was always correct if you downloaded it from the GitHub Smartfeed page.

Smartfeed 3.0.6 released

The extension has been submitted for phpBB extension team review. You can download it here.

Of note:

  • All corrections required by the extensions review team have been addressed. All code was reviewed in PhpStorm to fix problematic issues and remove unneeded variables.
  • Supports phpBB 3.1.9 through 3.2 (Rhea)
  • Fixed bug that did not provide the encryption key (e parameter) with the embedded IP in the Smartfeed URL if Require IP Authentication is turned on in the ACP, leading to an erroneous error message if the URL for the feed is used.
  • Ability to use the ACP interface now requires the acl_a_extensions permission instead of acl_a_board permission
  • Copyrights changed to 2017
  • Containers are used to fetch global variables
  • jQuery UI library added to support enhanced dialog boxes
  • Where appropriate Javascript events now written in jQuery
  • CDATA removed from templates, as they are not needed in HTML5
  • Javascript without template variables moved into .js files
  • Host URL updated to use www prefix
  • Some previously allowed tags in Safe HTML were removed as they are deprecated

phpBB 3.2 Rhea, second look

With phpBB 3.2.0 Rhea now officially released, I have some additional observations about this minor release of phpBB beyond my last post.

  • All libraries needed are part of the archive, so there is no reason to run Composer before installing. This is good and makes life easier but there are more files to upload and the archive is getting fatter: 7.5MB zipped, 33MB unzipped.
  • The installer’s progress bar is slow to give feedback, leading perhaps to the impression that it has stalled. Wait and your patience will be rewarded.
  • Upon successful installation there are two options/extensions enabled. The first allows you to send your statistics to phpbb.com to improve the product. This was there previously but now it’s a simple checkbox and it can be enabled or disabled later. It has its own item in the Administration Control Panel: ACP > General > Server Configuration > Help support phpBB. More unusual is a new phpBB Group developed extension that integrates with VigLink. If you enable this extension, it adds URL tracking information when you or a forum user shares a URL. It allows the phpBB Group to generate some small revenue when people click on these links and then click on a targeted ad. You can uncheck this but it is enabled by default. It too has an item in the ACP: ACP > General > Board configuration > VigLink settings.
  • When installing a new board, you get a default category, forum and post, but no search index is populated with the post. Instead, you are reminded to create a search index. This allows you to create a different search index type if you want, but it’s an extra and new step to the installation process.
  • If you edit a post, the edit window is smaller, in that it shows fewer lines. You can drag the window to make it bigger but some people will find this change a bit irritating.

I had done a smoke test with my Smartfeed and Digests extensions. I posted about Smartfeed here, and Digests here. Look for new releases of both in the coming weeks and months that will support phpBB 3.2.

With the release the phpBB Group has published a features page with the major new features.

I’ll post more observations as I use it more.