SMF Forum Integration
Posted: Thu Aug 19, 2010 4:07 pm
This is how I got CMSMS to utilise the SSI functions which come with Simple Machines Forum. They allow you to display details from your forum outside of your forum pages.
First you need to make some changes in SMF's files so open up your FTP.
Find load.php which will be in 'SMFroot'/Sources/ where 'SMFroot' is the root folder of your SMF. In may case it was mysite.com/forum/sources for example.
In that file find...
...and change it to...
This is to stop SMF and CMSMS's sessions conflicting.
Next go into the admin panel of the SMF and go to configuration -> server settings -> cookies and sessions ('cookies and sessions' may be named 'feature configurations' on older versions of SMF. The version I am using here is 2.0 RC3.). Make sure the following options are set to:
Enable local storage of cookies = off
Use subdomain independent cookies = on
Use database driven sessions = on
Now create a user defined tag called smf_forum. Make sure you change the first part of the code to match the root to your own SSI file.
You need to place this tag, {smf_forum}, before anything else on your template. Including tags.
Now make another user defined tag called smf_function.
That's it. Now you can place {smf_function include="yourinclude"} where 'yourinclude' is the name of the SSI function you wish to call.
For example {smf_function include="boardStats"} will return the following stats about your forum:
Total Members: 2
Total Posts: 3
Total Topics: 1
Total Categories: 1
Total Boards: 1
You could then wrap that in a div and style it etc.
Here is a list of possible functions you can use. To find out more about what they do, go to http://www.simplemachines.org/community/ssi_examples.php.
ssi_recentTopics, ssi_recentPosts, ssi_topBoards, ssi_topTopicsViews, ssi_topTopicsReplies, ssi_topPoll, ssi_recentPoll, ssi_topPoster, ssi_showPoll, ssi_latestMember, ssi_boardStats, ssi_whosOnline, ssi_logOnline, ssi_welcome, ssi_news, ssi_boardNews, ssi_menubar, ssi_quickSearch, ssi_login, ssi_logout, ssi_todaysBirthdays, ssi_todaysHolidays, ssi_todaysEvents, ssi_todaysCalendar, ssi_recentEvents
Remember if you are using the code above, you don't have to put ssi_ in the parameter as the user defined tag does that for you.
Hope that helps someone. ;)
First you need to make some changes in SMF's files so open up your FTP.
Find load.php which will be in 'SMFroot'/Sources/ where 'SMFroot' is the root folder of your SMF. In may case it was mysite.com/forum/sources for example.
In that file find...
Code: Select all
// Attempt to change a few PHP settings.
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&');
Code: Select all
// Attempt to change a few PHP settings.
if (session_id() == '') {
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&');
}
Next go into the admin panel of the SMF and go to configuration -> server settings -> cookies and sessions ('cookies and sessions' may be named 'feature configurations' on older versions of SMF. The version I am using here is 2.0 RC3.). Make sure the following options are set to:
Enable local storage of cookies = off
Use subdomain independent cookies = on
Use database driven sessions = on
Now create a user defined tag called smf_forum. Make sure you change the first part of the code to match the root to your own SSI file.
Code: Select all
require_once('[i]forum/SSI.php[/i]');
$Referrer = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$_SESSION['login_url'] = $Referrer;
Now make another user defined tag called smf_function.
Code: Select all
$ssiprefix = 'ssi_';
$ssiparam = $params['include'];
$ssiinclude = $ssiprefix . $ssiparam;
$ssiinclude();
For example {smf_function include="boardStats"} will return the following stats about your forum:
Total Members: 2
Total Posts: 3
Total Topics: 1
Total Categories: 1
Total Boards: 1
You could then wrap that in a div and style it etc.
Here is a list of possible functions you can use. To find out more about what they do, go to http://www.simplemachines.org/community/ssi_examples.php.
ssi_recentTopics, ssi_recentPosts, ssi_topBoards, ssi_topTopicsViews, ssi_topTopicsReplies, ssi_topPoll, ssi_recentPoll, ssi_topPoster, ssi_showPoll, ssi_latestMember, ssi_boardStats, ssi_whosOnline, ssi_logOnline, ssi_welcome, ssi_news, ssi_boardNews, ssi_menubar, ssi_quickSearch, ssi_login, ssi_logout, ssi_todaysBirthdays, ssi_todaysHolidays, ssi_todaysEvents, ssi_todaysCalendar, ssi_recentEvents
Remember if you are using the code above, you don't have to put ssi_ in the parameter as the user defined tag does that for you.
Hope that helps someone. ;)