Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
requests-topic
5.1 Update - A Couple of API Changes
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 5, 2012 - 6:20 pm

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.

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626