SMF SSI.php Functions
Current Version: 2.1.4
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:
<?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.
Recent Topics Function
Code (simple mode)
<?php ssi_recentTopics(); ?>
Code (advanced mode)
<?php ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>
Result
[Free Themes] | NameX by magnus | April 12, 2024, 11:13:19 AM |
[Premium Themes] | LikeIPB by Diego Andrés | March 24, 2024, 02:18:56 PM |
[Premium Themes] | Darkec by mestrecruz | February 05, 2024, 09:33:09 AM |
[Premium Themes] | Stope by Steve | December 24, 2023, 11:21:37 AM |
[Free Themes] | Repulse by Diego Andrés | December 05, 2023, 06:41:48 PM |
[Pre-sale Questions] | ¿Hacen trabajo personalizado? by Diego Andrés | October 20, 2023, 06:42:41 PM |
[Premium Themes] | Kali by Diego Andrés | October 20, 2023, 06:41:58 PM |
[Pre-sale Questions] | Comet Theme Responsiveness by Diego Andrés | October 02, 2023, 02:49:17 PM |
Recent Posts Function
Code
<?php ssi_recentPosts(); ?>
Result
[Free Themes] | Re: NameX by magnus | April 12, 2024, 11:13:19 AM |
[Free Themes] | Re: NameX by Diego Andrés | April 12, 2024, 11:06:23 AM |
[Free Themes] | Re: NameX by magnus | April 12, 2024, 11:03:16 AM |
[Free Themes] | Re: NameX by Diego Andrés | March 26, 2024, 08:24:46 AM |
[Free Themes] | Re: NameX by Thrawn | March 26, 2024, 03:11:30 AM |
[Premium Themes] | Re: LikeIPB by Diego Andrés | March 24, 2024, 02:18:56 PM |
[Premium Themes] | Re: Re: Theme LikeIPB by Diego Andrés | March 24, 2024, 12:19:39 PM |
[Premium Themes] | Re: Theme LikeIPB by bluecrab | March 24, 2024, 12:14:35 PM |
Top Boards Function
Shows top boards by the number of posts.
Code
<?php ssi_topBoards(); ?>
Result
Board | Topics | Posts |
---|---|---|
Soporte General SMF | 0 | 240,659 |
SMF Support | 0 | 26,725 |
Free Themes New | 52 | 1,044 |
Premium Themes New | 47 | 340 |
Free Mods New | 17 | 186 |
Tips and Tutorials New | 34 | 182 |
Previews New | 31 | 143 |
Chit Chat New | 46 | 136 |
Pre-sale Questions New | 32 | 114 |
Theme Requests New | 31 | 94 |
Top Topics
Shows top topics by the number of replies or views.
Code (show by number of views)
<?php ssi_topTopicsViews(); ?>
Result
Views | Replies | |
---|---|---|
Reseller | 449,737 | 377 |
Redsy | 188,492 | 122 |
Gaming Nation | 129,102 | 61 |
Wrap | 100,710 | 85 |
Exodus | 97,508 | 53 |
Greeny | 78,276 | 44 |
LikeIPB | 63,143 | 28 |
SMF Post Prefix | 62,839 | 59 |
Teatro | 56,012 | 9 |
Materialistic - Responsive Colorpicker theme | 53,966 | 19 |
Code (show by number of replies)
<?php ssi_topTopicsReplies(); ?>
Result
Views | Replies | |
---|---|---|
Reseller | 449,737 | 377 |
Redsy | 188,492 | 122 |
Wrap | 100,710 | 85 |
Gaming Nation | 129,102 | 61 |
SMF Post Prefix | 62,839 | 59 |
Exodus | 97,508 | 53 |
Greeny | 78,276 | 44 |
NameX | 19,816 | 37 |
Team Page | 44,647 | 30 |
LikeIPB | 63,143 | 28 |
Top Poster Function
Shows the top poster's name and profile link.Code
<?php ssi_topPoster(); ?>
Result
Latest Member Function
Shows the latest member's name and profile link.
Code
<?php ssi_latestMember(); ?>
Result
Member of the Day
Shows one random member of the day. This changes once a day.
Code
<?php ssi_randomMember('day'); ?>
Result
frici84
SMF Tricks rules |
Who's Online Function
This function shows who are online inside the forum.
Code
<?php ssi_whosOnline(); ?>
Result
online web development
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
<?php ssi_logOnline(); ?>
Result
online web development
Login Function
Shows a login box only when user is not logged in.
Code
<?php ssi_login(); ?>
Result
Logout Function
Shows a logout link only when user is logged in.
Code
<?php ssi_logout(); ?>
Result
Welcome Function
Greets users or guests, also shows user's messages if logged in.
Code
<?php ssi_welcome(); ?>
Result
Today's Calendar Function
Code
<?php ssi_todaysCalendar(); ?>
Result
Today's Birthdays Function
Code
<?php ssi_todaysBirthdays(); ?>
Result
Today's Holidays Function
Code
<?php ssi_todaysHolidays(); ?>
Result
Today's Events Function
Code
<?php ssi_todaysEvents(); ?>
Result
Forum Stats
Shows some basic forum stats: total members, posts, topics, boards, etc.
Code
<?php ssi_boardStats(); ?>
Result
Board News Function
Shows the latest posts from read only boards, or a specific board.
Code
<?php ssi_boardNews(); ?>
Result
SMF 2.0.17 Released
QuoteDear Members,
Simple Machines has released a new patch to the 2.0.x line of SMF, bringing our latest release version to 2.0.17.
We consider this patch to be of crucial importance, as it includes important fixes for a critical bug that was introduced in SMF 2.0.16.
Under certain circumstances, SMF 2.0.16 would start consuming significant amounts of CPU-resources when the RSS function is used.
Please see the changelog for more information.
Since SMF 2.0.17 is essentially what 2.0.16 was intended to be and 2.0.16 was released only a few days ago, we are including the SMF 2.0.16 announcement for your convenience:
SMF 2.0.16 contains important security and bug fixes, as well as support for the European Union's General Data Protection Regulation (GDPR) requirements. We recommend updating as soon as possible.
Notable changes in 2.0.16Please see the changelog for more information.
- Support for privacy policy in addition to registration agreement
- GDPR Compliance toggle in Core Features
Enabling this configures multiple settings and new features to comply with the GDPR, including:
- Requiring members to accept the current privacy policy in order to use the forum
- Asking during registration whether the new member wants to receive announcements via email
- Enabling token-based unsubscribe links in emails so members can unsubscribe without logging in
- Allowing members to download a copy of their profile information
- Adjusting the behaviour of a number of other features in minor ways as necessary
- PHP 7.2 support
- Improved security hashes for the image proxy
- Improved security for the login cookie
- Assorted other security improvements
- Various improvements for both the installer and upgrader
IMPORTANT NOTES:
- If you are using the GDPR Helper mod, you should follow these steps:
- Back up your existing privacy policy text to a file somewhere
- Update the GDPR Helper mod to its latest version
- Uninstall the GDPR Helper mod
- Install the SMF 2.0.16 patch
- All users, including the admin, will need to log in again after 2.0.16 has been installed.
How to update to 2.0.16
If you are running version 2.0.16, you can update your forum to the latest version by using the package manager. You should see the update notification in the admin panel notifications and in the package manager, which will allow you to download and install the patch seamlessly. If you do not see the notification about the patch, please run the scheduled task "Fetch Simple Machines files" from the Scheduled Tasks page (Admin > Maintenance > Scheduled Tasks). If you are still running version 2.0.15, you can first patch to 2.0.16 and then patch to 2.0.16 immediately afterwards. We apologise for the inconvenience.
If you use older versions of SMF, you can upgrade directly to 2.0.16 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.
Language packages for 2.0.16 - Translators wanted!
Adding GDPR support required changes to several of SMF's language files in 2.0.16 (and higher). Updates to SMF's supported language packages will become available as the translations of those changes are completed.
If you can help translate these changes into your language, we would love to hear from you!
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!
Regards,
Simple Machines
SMF 2.0.16 Released
QuoteDear Members,
Simple Machines has released a new patch to the 2.0.x line of SMF, bringing our latest release version to 2.0.16.
We consider this patch to be of crucial importance, as it includes important security and bug fixes, as well as support for the European Union's General Data Protection Regulation (GDPR) requirements. We recommend updating as soon as possible.
[Edit (m4z)]: We found a critical bug regarding CPU usage when XML/RSS feeds are used in 2.0.16, and will be releasing a fix in the coming days. In the meantime, if you have already updated to 2.0.16, and notice your CPU time being eaten up, please disable the feature under Admin > Main > News and Newsletters > Settings > Enable XML/RSS news!
If you really depend on the feed feature, see this thread for a workaround.
Notable changes in 2.0.16Please see the changelog for more information.
- Support for privacy policy in addition to registration agreement
- GDPR Compliance toggle in Core Features
Enabling this configures multiple settings and new features to comply with the GDPR, including:
- Requiring members to accept the current privacy policy in order to use the forum
- Asking during registration whether the new member wants to receive announcements via email
- Enabling token-based unsubscribe links in emails so members can unsubscribe without logging in
- Allowing members to download a copy of their profile information
- Adjusting the behaviour of a number of other features in minor ways as necessary
- PHP 7.2 support
- Improved security hashes for the image proxy
- Improved security for the login cookie
- Assorted other security improvements
- Various improvements for both the installer and upgrader
IMPORTANT NOTES:
- If you are using the GDPR Helper mod, you should follow these steps:
- Back up your existing privacy policy text to a file somewhere
- Update the GDPR Helper mod to its latest version
- Uninstall the GDPR Helper mod
- Install the SMF 2.0.16 patch
- All users, including the admin, will need to log in again after 2.0.16 has been installed.
How to update to 2.0.16
If you are running version 2.0.15, you can update your forum to the latest version by using the package manager. You should see the update notification in the admin panel notifications and in the package manager, which will allow you to download and install the patch seamlessly. If you do not see the notification about the patch, please run the scheduled task "Fetch Simple Machines files" from the Scheduled Tasks page (Admin > Maintenance > Scheduled Tasks).
If you use older versions of SMF, you can upgrade directly to 2.0.16 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.
Language packages for 2.0.16 - Translators wanted!
Adding GDPR support required changes to several of SMF's language files in 2.0.16. Updates to SMF's supported language packages will become available as the translations of those changes are completed.
If you can help translate these changes into your language, we would love to hear from you!
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!
Regards,
Simple Machines
Summer 2019 discounts!
Coupon: Summer19 - 30% off
Regards,
SMF Tricks Team.
Winter discounts
In your next order, use the coupon SMFxMas to get a 30% discount in your purchase
Regards.
SMF Tricks Team
- 2 people like this.
SMF Tricks V5
It's been a couple of years since the release of our previous version the V3, and after taking too long with the V4 we decided to drop it and start over and move on into the next one, and here we are.
This new version has a better and more friendly design, along with an easier access to everything on the site. Some of the different areas and sections have been revamped, such as the store and downloads section, for the most part, and we hope it was for the better.
We are open to all of your suggestions if you think something can be improved or you found a bug among all the edits.
2018 will for sure be an amazing year and we will try as a team to bring you new and better content in terms of themes and mods if possible. We are really looking forward to get all of your feedback.
I hope you all enjoy this new version.
Thanks
- 7 people like this.
Show Single Poll
Shows a poll in the specified topic.
Code
<?php ssi_showPoll($topicID); ?>
Result
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 overridden by passing the 2nd parameter as true.
Code
<?php ssi_fetchPosts($postIDs, $isOverride); ?>
Result
Show Single Member
Shows the specified member's name and profile link.
Code
<?php ssi_fetchMember($memberIDs); ?>
Result
Show Group Members
Shows all members in a specified group.
Code
<?php ssi_fetchGroupMembers($groupIDs); ?>
Result
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
<?php require("SSI.php"); ?>
<!DOCTYPE html>
<html>
<head>
<title>SSI.php example for home page</title>
<style>
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">YourWebsite.com</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="noopener" rel="license" href="https://creativecommons.org/licenses/publicdomain/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/publicdomain/88x31.png"></a>
This sample website layout is dedicated to the <a target="_blank" rel="noopener" rel="license" href="https://creativecommons.org/licenses/publicdomain/">Public Domain</a>.
</div>
</div>
</body>
</html>