Integrating WordPress and SMF

We here at Hijinks Inc. are in the process of rolling out a forum section to the site using Simple Machines Forum, or SMF. And while we aren’t integrating user databases at this point we did want to find a way to bridge some of the information between our WordPress blog and the forum.

Today I’m going to cover how we integrated the blog into the Who’s Online page for SMF with instructions on how you can do this on your own site.

For starters, SMF provides a nice feature set in SSI.php, but in order to use any of them in widgets you’ll need to install the Exec-PHP plugin for WordPress. Grab the plugin and install/activate it like you normally would.

Next you’ll need to add something similar to this to your blog’s header (usually header.php for a WordPress Theme):


Originally we started using the ssi_logOnline function to include users reading the blog, but we weren’t happy that it still showed them as viewing the forum instead of the blog on the Who’s Online list, so in order to fix this we switched to using ssi_whosOnline in our sidebar as a widget.

Who's Online Widget

Then added this code to our blog footer:

$_GET['action'] = 'blog';

Note: Using the above code still logs user activity.

We also added in variations of this function to the mobile footer and the single post footer to show when users were viewing those pages specifically. If you’d like to do that on your site, just change out the bolded text in the above code with something like mobile and add it to those template files individually.

To further explain:
$_GET[‘action’] = ‘blog‘;  goes at the end of your WordPress theme’s Main Index Template.

$_GET[‘action’] = ‘blogpage‘;  goes at the end of your Page Template.
The next step is to add the corresponding blog function to Who.english.php (located in your SMF install \Themes\default\languages).

Pretty simple stuff, open up Who.english.php and find $txt['whoall_.xml'] = 'Viewing an XML feed.'; and add something like…

$txt['whoall_blog'] = 'Viewing the main page of the <a href="">Your Blog Name Here Blog</a>.';

…on a new line. Repeat this for every action you’d like to add, naturally changing the whoall_blog to whoall_whateveryourfunctionnameis.

If you have any question, hit me up in the comments.

Published by

Aaron Nelsen

is the webmaster and senior technology editor. He's a career geek, coffee enthusiast, Apple fanboy, and accomplished barista pimp.

Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/24/d248147710/htdocs/ on line 399

Leave a Reply