SMF SSI.php Functions

Current Version: 2.0

This file is used to demonstrate the capabilities of SSI.php using PHP include functions. The examples show the include tag, then the results of it.

Include Code

To use SSI.php in your page add at the very top of your page before the <html> tag on line 1 of your php file:

Code: [Select]
<?php require("SSI.php"); ?>

Some notes on usage

All the functions have an output method parameter. This can either be "echo" (the default) or "array"

If it is "echo", the function will act normally - otherwise, it will return an array containing information about the requested task. For example, it might return a list of topics for ssi_recentTopics.

This functionality can be used to allow you to present the information in any way you wish.

Additional Guides & FAQ

Need more information on using SSI.php? Check out Using SSI.php article or the SSI FAQ.

Recent Topics Function

Code (simple mode)

Code: [Select]
<?php ssi_recentTopics(); ?>

Code (advanced mode)

Code: [Select]
<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>


Recent Poll Function


Code: [Select]
<?php ssi_recentPoll(); ?>


Top Boards Function

Shows top boards by the number of posts.


Code: [Select]
<?php ssi_topBoards(); ?>


Board Topics Posts
SMF Online Manual 0 5,531,999
Bosanski (Bosnian) 0 2,848,890
Hrvatski (Croatian) 0 2,830,370
Srpski (Serbian) 0 2,775,583
Bugtracker (Github) 0 2,753,088
SMF 1.1.x Support New 82,851 520,372
SMF 2.0.x Support New 48,844 365,107
Modifications and Packages New 2,684 337,479
Arşiv New 31,575 228,763
Español (Spanish) New 29,535 176,449

Top Topics

Shows top topics by the number of replies or views.

Code (show by number of views)

Code: [Select]
<?php ssi_topTopicsViews(); ?>


Code (show by number of replies)

Code: [Select]
<?php ssi_topTopicsReplies(); ?>


Top Poll Function

Shows the most-voted-in poll.


Code: [Select]
<?php ssi_topPoll(); ?>


Top Poster Function

Shows the top poster's name and profile link.


Code: [Select]
<?php ssi_topPoster(); ?>


Latest Member Function

Shows the latest member's name and profile link.


Code: [Select]
<?php ssi_latestMember(); ?>


Please welcome jhonpty, our newest member.

Member of the Day

Shows one random member of the day. This changes once a day.


Code: [Select]
<?php ssi_randomMember('day'); ?>


Who's Online Function

This function shows who are online inside the forum.


Code: [Select]
<?php ssi_whosOnline(); ?>


Log Online Presence

This function logs the SSI page's visitor, then shows the Who's Online list. In other words, this function shows who are online inside and outside the forum.


Code: [Select]
<?php ssi_logOnline(); ?>


Login Function

Shows a login box only when user is not logged in.


Code: [Select]
<?php ssi_login(); ?>



Logout Function

Shows a logout link only when user is logged in.


Code: [Select]
<?php ssi_logout(); ?>


Welcome Function

Greets users or guests, also shows user's messages if logged in.


Code: [Select]
<?php ssi_welcome(); ?>


Welcome, Guest. Please login or register.
Did you miss your activation email?

Today's Calendar Function


Code: [Select]
<?php ssi_todaysCalendar(); ?>


Today's Birthdays Function


Code: [Select]
<?php ssi_todaysBirthdays(); ?>


Today's Holidays Function


Code: [Select]
<?php ssi_todaysHolidays(); ?>


Today's Events Function


Code: [Select]
<?php ssi_todaysEvents(); ?>


Recent Calendar Events Function


Code: [Select]
<?php ssi_recentEvents(); ?>


Forum Stats

Shows some basic forum stats: total members, posts, topics, boards, etc.


Code: [Select]
<?php ssi_boardStats(); ?>


Total Members: 442,353
Total Posts: 3,850,760
Total Topics: 458,468
Total Categories: 13
Total Boards: 224

News Function

Shows random forum news.


Code: [Select]
<?php ssi_news(); ?>


Wondering if this will always be free?  See why free is better.

Board News Function

Shows the latest posts from read only boards, or a specific board.


Code: [Select]
<?php ssi_boardNews(); ?>


xx SMF 2.1 RC4 Released

July 10, 2021, 11:45:38 AM by Suki
Simple Machines is pleased to announce the release of SMF 2.1 RC4. Bugs reported and labeled for RC4 have been fixed along with improvements to security, stability, and performance. Some of the fixes and improvements are as follows:

Major changes:
  • Raises minimum PHP version to 5.6
  • Updates SCEditor to version 3 and fixes multiple editor bugs
  • Improves numerous database queries
  • Makes numerous improvements to theme templates and CSS
  • Makes numerous corrections and improvements to language strings and documentation
  • Allows CORS requests in SMF

User-facing changes:
  • Uses "Forever" as the default time option when logging in
  • Moves logout button to profile menu (with fallback for non-JS users)
  • Sends HTTP error code 403 (Forbidden) when a banned user tries to log in
  • Handles TFA enable/disable menu items consistently in profile menu
  • Redirects user back to previous URL after changing language
  • Prevents bogus mention notifications
  • Fixes various issues with setting user notification preferences
  • Adds functionality to remove old alerts after they have been read
  • Avoids showing an alert counter with a value of zero
  • Improves the UI for attachment uploads
  • Improves the templates and UI logic for the PM system
  • Fixes an issue with pagination while viewing PM drafts
  • Improves handling of time zones
  • Uses correct time zone when suggesting default times for a new event
  • Fixes issues involving max width of images on different screens
  • Fixes issues with attachment images when printing a topic
  • Always uses correct rotation for attachment thumbnails
  • Fixes several errors while uploading attachments
  • Fixes a permissions issue that never allowed guests to upload images
  • Uses lazy loading for external avatars, BBC images, iframes, etc.
  • Improves BBC parsing in board descriptions
  • Keeps order of poll choices consistent across time
  • Neutralizes evil control characters in preparsecode()
  • Renders quotes with nested url tags correctly
  • Fixes an error when attempting to preview a poll
  • Allows the time picker script to be translated
  • Respects drafts_autosave_enabled user setting
  • Removes obsolete spellcheck feature

Admin and back-end changes:
  • Fixes issues with reordering custom profile fields
  • Improves email notifications regarding registration approval
  • Fixes an issue where notifications about reported members used "(N/A)" instead of the member's name
  • Improves UI to display the error log
  • Improves package manager UI
  • Improves the smiley editor
  • Fixes issues regarding time zones in admin member search
  • Allows the email field to be disabled for guests
  • Hides random news line from guests who cannot browse the forum
  • Confirms logouts and redirects when necessary (improves interactions with external integrations)
  • Implements new, more robust version of updateSettingsFile()
  • Retires old entries in log_packages table when a package is upgraded
  • Fixes issue logging changes to custom fields when nothing actually changed
  • Prunes log_topics, log_boards & log_mark_boards_read during maintenance
  • Fixes an issue with logging moderation actions
  • Fixes errors when an external avatar URL was too long
  • Fixes "Out of range value for column page_hits" error
  • Fixes issues regarding $user_info in background tasks
  • Shows correct file names in integration hooks list
  • Adds support for more password hashing schemes for converters
  • Fixes a session write fail issue
  • Fixes issues when merging topics
  • Ensures $modSettings['board_manager_groups'] is always defined
  • Ensures trackStats() & AddMailQueue() exist before calling them in obExit()
  • Improves get_proxied_url() and general proxy handling
  • Supports Cloudflare in auto-detection of Reverse Proxy IP headers
  • Avoids a database error on MariaDB during profile export
  • Fixes an undefined index error when board has grandchild boards
  • Fixes autoloading for cache classes
  • Fixes an issue where membergroups were not displayed via SSI Who's Online
  • Removes WHOIS link, since they no longer support it
  • Adds link to the Read Logs settings from the Scheduled Tasks settings
  • Improves handling of 4-byte UTF-8 in script.js

Installer and upgrader changes:
  • Fixes issues installing SMF on PHP 8.0
  • Fixes typos affecting the installer
  • Fixes upgrader freezes
  • Fixes handling of legacy attachments during upgrade
  • Fixes undefined PHP function error during upgrade
  • Includes karma data in database backup during upgrade
  • Create record for all watched topics and boards during upgrade
  • Improves handling of some HTTPS URLs during upgrade
  • Correctly preserves membergroup properties during upgrade
  • Correctly handles invalid year-only birthdates during upgrade
  • Fixes issues with deleting upgrader files after upgrade is complete
  • Fixes issues with running the upgrader from CLI
  • Fixes various database queries in the upgrader
  • Sets default notification frequency to "Straight Away" instead of "Never"
  • Fixes issues upgrading from SMF 1.x
  • Fixes registration "no access" error after upgrading

This release is considered to be an RC (Release Candidate), which means that it is sufficiently functional, but that it has known and unknown bugs. These bugs do not necessarily prevent a release, rather they need to be addressed before the next dev cycle release.

SMF RC4 can be installed as a brand new installation, or an SMF 2.0.x installation can be upgraded to SMF RC4, however, please do note that there are no updates packages for any RC releases.

We highly encourage testing this version on local or development/QA environments. Testing the release will greatly help us in narrowing down, and focusing on, issues and improvements towards the Final release.  Note, however, that we do not recommend using an RC package on any live installation and/or production forum owing to the very nature of RC packages.

Finally, this announcement topic is not for support. Please use the SMF 2.1 support board instead.

A very special thanks goes to our community, team members, code contributors and beta testers. Without your help, this would not have been possible.

Thank you for using SMF!

Kind regards,
Simple Machines
56 comments | Write Comment

xx SMF moves to a new translation platform: switching to Crowdin

March 16, 2021, 04:01:20 AM by Dzonny
SMF moves to a new translation platform: switching to Crowdin

As SMF continues to grow, it has adapted to the increasing needs of the community and our translators. Up until this point, we have been using our own translation management tool called 'Language Editor (LE)'.  This has served the community very well for years, however, over time, it has become more difficult for the Team to maintain.  As such, we have decided to change to Crowdin.

Crowdin works smoothly and allows for a more flexible translation process. Furthermore, it provides many useful features, such as global translation memory, machine translations, and online editors. It offers convenient ways to comment on existing texts and to report mistakes or problems. As a result, using Crowdin will make it much easier to discuss, for example, the terminology, meaning, and optimal translation of each and every software string.  We believe that Crowdin will help us to optimize the translation process. It will make the process of translating faster and facilitate problem solving, resulting in higher quality translations

Want to improve SMF in your language? Here is how you can help

If you like SMF and want to contribute by translating it into your language, sign up at Crowdin, go to our page and start translating. We are looking forward to seeing you there.  If you have already registered on our SMF community forum, just use this link to proceed and join our project on Crowdin without the need to additionally sign up on their page.  All you need to do is to log in with your SMF account.

We understand that using the new platform may seem quite complicated for users who have not used it before, so we have written this article for current and potential translators, which includes detailed guidelines on how to translate SMF on Crowdin to make it easier for you to work with this software.

Please note that Crowdin will be officially used as the Translation Management Software from branch 2.1 onwards. Older branches of the software will continue to be updated using the LE (Language Editor) until EOL (end of life).

How translation is changing

Nothing has significantly changed in our translation management system on the new platform, but there are some important differences in terminology that Senior Translators, in particular, need to be aware of.  For instance, SMF Senior Translators will become Proofreaders on Crowdin, but their role remains the same.
Proofreaders (Senior Translators) will continue to:
•   Approve/unapprove translations;
•   Be responsbible for overseeing the accuracy of translations;
•   Answer questions and requests in comments;
•   Resolve issues.

Please note that on the SMF community, Senior Translators will still be referred to as such and the change in Crowdin is purely one of terminology, rather than a change of role.  If anything, the new tools available in Crowdin enhance the role of a Senior Translator and make it easier for them to carry out their duties.

49 comments | Write Comment

xx SMF 2.0.18 Released

February 01, 2021, 04:50:07 PM by Suki
Dear Members,

Simple Machines is pleased to announce a new patch for the 2.0.x line of SMF, which pushes the version number to 2.0.18.

The patch is focused on PHP 7.4 support as well as other issues encountered on previous versions such as
  • Policy acceptance missing id_member.
  • Addresses PHP parse errors when using SMF file cache
  • Avoids truncating Settings.php until after we have a lock on the file
  • Tighten up security checks, bring in sync with 2.1
  • Brought the UTF16-to-UTF8 logic over from 2.1
  • Always include email address when downloading user's own profile data
  • Fix missing info affecting logging for new registrations
  • Fixes bugs with multi-version jumps (via CLI) where settings weren't refreshed
  • Set utf8 as default going forward

Please see the changelog for more information.

If you are currently using version 2.0.17 you can perform the update using the package manager, once available you will see a notification update within your admin panel. please run the scheduled task "Fetch Simple Machines files" from the Scheduled Tasks page (Admin > Maintenance > Scheduled Tasks). Same logic applies if you want to update your forum from an older version, you can apply each patch successively until you reach out to 2.0.18

If you use an older version of SMF, you can upgrade directly to 2.0.18 from whichever version you are currently using by using the "Large Upgrade" package from the Download page. Be aware that using this upgrade method will require you to reinstall any customizations that you have added to your forum, so if you are running a version of the 2.0.x series, it is recommended that you apply the successive patches instead of using the Large Upgrade.

If you are having problems downloading the patch from the admin panel, you can download the patch package from the Package Manager Updates page and install it via the Package Manager, as you would any other mod package.

Please refer to the Online Manual for more details about patching and upgrading.

Finally, as always, please do not use this topic for support requests. You will receive a much quicker and better response by posting in the 2.0.x Support Board.

Thank you for using SMF!

Simple Machines
69 comments | Write Comment

xx SMF Welcomes Lex as The New Project Manager

January 17, 2021, 03:21:38 PM by Irisado
The SMF Team has recently held its annual election for the position of Project Manager.

After a number of years in the position Illori has chosen to step down to focus on providing support and Lex, who had been the Support Team lead up until this point, has won the election to become the new Project Manager for SMF.

The Team thanks Illori for all her hard work as Project Manager and welcomes Lex into the position.  Please join us in thanking Illori for all her hard work and congratulating Lex on his successful election.
40 comments | Write Comment

xx SMF 2.1 RC3 Released

October 15, 2020, 07:16:48 PM by Suki
Simple Machines is pleased to announce the release of SMF 2.1 RC3. Bugs that were reported after the release of RC2 have been fixed and improvements have been made to security, stability, and performance. The many fixes and improvements include the following:

- Enhanced privacy policy support.
- Several important enhancements to PostgreSQL and MySQL.
- Multiple hooks added for handling data and/or presentation.
- Language files now uses sprintf() whenever possible.
- Theme enhancements/fixes.
- Improvements on Admin session checks.
- Enhancements on security: tokens, hashing cookies and better session handling.
- Multiple calendar fixes/enhancements.
- Better hashing system for the image proxy.
- Bug fixes for alert notifications.
- Added unsubscribe links for announcement emails.
- PHP 7.4 support.
- Several misc bug fixes/improvements.
- Download of posts/PMs/profile for GDPR.

This release is considered to be an RC (Release Candidate), which means that it is sufficiently functional, but that it has known and unknown bugs. These bugs do not necessarily prevent a release, rather they need to be addressed before the next dev cycle release.

SMF RC3 can be installed as a brand new installation, or an SMF 2.0.x installation can be upgraded to SMF RC3, however, please do note that there are no updates packages for any RC releases.

We highly encourage testing this version on local or development/QA environments. Testing the release will greatly help us in narrowing down, and focusing on, issues/improvements towards the Final release... However, we do not recommend using an RC package on any live installation and/or production forum due to the very nature of RC packages.

Finally, this announcement topic is not for support. Please use the SMF 2.1 support board instead.

A very special thanks goes to our code contributors, Teamies, and non-Teamies whose reports and pull requests have greatly helped us not only to reach our goals, but also to create/grow/improve our development cycle. 

Thank you for using SMF!

Kind regards,
Simple Machines


Menubar Function

Displays a menu bar, like one displayed at the top of the forum.


Code: [Select]
<?php ssi_menubar(); ?>


Quick Search Function


Code: [Select]
<?php ssi_quickSearch(); ?>


Recent Attachments Function


Code: [Select]
<?php ssi_recentAttachments(); ?>


Show Single Poll

Shows a poll in the specified topic.


Code: [Select]
<?php ssi_showPoll($topicID); ?>


Not shown because it needs specific topic ID that contains a poll.

Show Single Post

Fetches a post with a particular IDs. By default will only show if you have permission to the see the board in question. This can be overriden by passing the 2nd parameter as true.


Code: [Select]
<?php ssi_fetchPosts($postIDs, $isOverride); ?>


Not shown because it needs a specific post ID.

Show Single Member

Shows the specified member's name and profile link.


Code: [Select]
<?php ssi_fetchMember($memberIDs); ?>


Not shown because it needs a specific member ID.

Show Group Members

Shows all members in a specified group.


Code: [Select]
<?php ssi_fetchGroupMembers($groupIDs); ?>


Not shown because it needs specific membergroup IDs.

Home Page Sample

This sample uses the following features: ssi_recentTopics(), ssi_logOnline(), ssi_welcome(), and ssi_boardNews(). ssi_recentTopics() is fetched using the array method, to allow further customizations on the output.


Code: [Select]
<?php require("SSI.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head> <title>SSI.php example for home page</title> <style type="text/css"> body { font-family: Arial, Tahoma, sans-serif; font-size: 80%; background: #DFDFDF; color: #FFFFFF; margin: 0 } ul,ol { padding-left: 19px; margin: 0; } li { font-size: 11px; } h1,h2,h3 { margin: 0; padding: 0; } h3 { font-size: 15px; } a:link,a:visited { color: #FF9000; text-decoration: none; } a:hover { text-decoration: underline; } #container { background: #52514E; width: 100%; border: 1px solid midnightblue; line-height: 150%; margin: 0; } #header,#footer { color: lightgray; background-color: #2A2825; clear: both; padding: .5em; } #leftbar { background: #DF7E00; float: left; width: 160px; margin: 0; padding: 1em; } #leftbar a { color: #000000; text-decoration: underline; } #content { margin-left: 190px; padding: 1em; } #navigation { float: right; } #navigation a:link,#navigation a:visited { color: #FF9000; } </style> </head> <body> <div id="container"> <div id="header"> <div id="navigation"> <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link</a> </div> <h1 class="header"></h1> </div> <div id="leftbar"> <h3>Recent Forum Topics</h3> <ul> <?php // Using array method to show shorter display style. $topics = ssi_recentTopics(8, null, null, 'array'); foreach ($topics as $topic) { // Uncomment the following code to get a listing of array elements that SMF provides for this function. // echo '<pre>', print_r($topic), '</pre>'; echo ' <li><a href=\"', $topic['href'], '\">', $topic['subject'], '</a> ', $txt['by'], ' ', $topics[$i]['poster']['link'], '</li>'; } unset($topics); ?> </ul><br /> <h3>Online Users</h3> <?php ssi_logOnline(); ?> </div> <div id="content"> <?php ssi_welcome(); ?><br /><br /> <h2>News</h2> <?php ssi_boardNews(); ?> </div> <div id="footer"> <a target="_blank" rel="license" href=""><img alt="Creative Commons License" style="border-width:0" src="" /></a> This sample website layout is dedicated to the <a target="_blank" rel="license" href="">Public Domain</a>. </div> </div> </body> </html>