5.1 Update – A Couple of API Changes

Time for another quick 5.1 update. Progress on the version continues nicely. As always, you can view all the 5.1 happenings on our development and bug tracking pages.

In this update, I thought I would cover a couple of API changes were are making in 5.1.

API’s (Application Programming Interface) are hooks available to Simple:Press plugin developers to allow their Simple:Press plugin to interact with core Simple:Press functions. These work similarly as the  WordPress Plugin API hooks do.

Normally, we resist making any API changes because it can break plugin or theme compatibility. We have chosen to make these changes in 5.1 because the base APIs were just introduced in 5.0 and its not likely that they have been used outside of core or our plugins.  If this turns out to not be the case, we can easily help you make the changes in your plugins.
The changes are being made because the current APIs turned out to not be the most efficient of design. Not from a performance stand point but from a usability perspective. Plugins had to do several steps to utilize them. These changes will make them easier to use.

The two APIs we are making slight modifications to are the sfmeta and member data APIs.
The sfmeta API is used store generic data for the forum in a WordPress user meta style table. Our smileys, forum ranks and a few other functions make use of the sfmeta API. The member data API is an API for reading or writing data from the sfmembers table in the database. It’s use is pretty widespread in core and plugins.

The change to sfmeta is how the meta value is stored in the database. Previously, the data was stored in whatever format the user sent to the API. So if you wanted to store an array or object, you had to do the serialization yourself before sending the data to the API – or unserialize yourself when receiving data from the API.
Now, the API will automatically handle data preparation both when sending and receiving data. This simplifies and reduces code in each usage and you don’t have to worry about the format of the data and deal with serialized arrays.

The change to the member data API is along similar lines of sfmeta.
While the member update has always handled the serialization (or unserializing) of data, it did so with a bunch of ‘IF’ statements on specific columns of data (a prior knowledge) in the sfmembers table. When plugins add columns of data in the sfmembers table, they had to handle the serialization of data themselves via a filter. With the API change, we have added the logic to determine the serialization in the API itself.
Now, as with sfmeta, users can now send and receive data objects to and from the API and not worry about serialized arrays. Those filters in plugins for handling serialization are no longer required.

It may not sound like much but changes had to be made to all the per-existing plugins and Simple:Press core files ,which took some effort, but in the long run both of these API changes will make everything easier for both you and us.

Hopefully, the change is early enough in the post 5.0 release era that it will not affect any user plugins. If it does, please let us know and we will help you get the new API usage in place.

Read Next

Did you find this article useful? Or do you use Simple:Press today?  If so, please support Simple:Press with a review on WordPress.org.  Every review goes a long way towards bringing other users on board!

Click here to review Simple:Press on wordpress.org

More From Simple:Press

What’s New In Simple:Press Forums 6.6.0

September 9, 2020

Simple:Press Forums 6.6.0 introduces two new major features and a lot of improvements to one of the existing features. And, of course, some bugs were stomped.

Read More

How We Increased Performance On Our Site By 300%

July 4, 2020

A few days ago we moved our site from Liquid Web to our new FireupWP and WPCloudDeploy project platform. This new platform allows us to use dedicated cloud VMs from places like Digital Ocean, Linode and Vultr. We pay the cost of the VMs with no markup which provides huge savings over regular hosts. We…

Read More

New Simple:Press Forum Theme: Modern 2020

March 5, 2020

A new default theme is coming to Simple:Press Forums with the release of Simple:Press Forums 6.5.0. Features of this theme: More modern looking with larger default font sizes and button sizes. Less use of tiny icons More color customization options Better display on mobile More white space Just like our previous default theme, Barebones, you…

Read More

Now Available: SPMS Version 2.7

January 10, 2020

Version 2.7 of Simple:Press Member Subscriptions is now available. It includes more than two dozen fixes and tweaks.

Read More