And in case you know how, how can I add the formstack icon to textview for the WP editor?
Hi Tim,
Investigating what we can do to try and help with this. The API itself doesn’t offer any sort of sort functionality but that doesn’t mean we can’t try to do something after the data has been received.
Noted on the request for the icon being in the text tab UI, on top of the visual editor tab.
Thanks Michael, I may hang on to plugin 1.x.x until some of these changes. These are huge for us. You do great work!
Does it store the data ‘cache’ in the database? Would it be as easy as alphabetizing a column?
we do store the API results as a WordPress option.
I have some stuff typed up in an internal branch that I hope will take care of the topic, but if you’d like to try it out yourself ahead of time, I’ll provide the code below.
Both changes will go in the apiv2.php file
On line 336-337, before the “update option” line, add this:
// Sort our cumulative results in alphabetical order before saving to option.
usort( $forms['forms'], array( $this, 'sort_alpha' ) );
After the closing } on line 343, and before the set_token_expiration method, add the following:
/**
* Helper method to organize our forms by alphabetical order.
*
* @since NEXT
*
* @param object $form1 First form object being compared.
* @param object $form2 Second form object being compared.
* @return int
*/
public function sort_alpha( $form1, $form2 ) {
return strcmp( $form1->name, $form2->name );
}
You’ll want to refresh your cache afterwards, so that it does a fresh fetch.
Thanks Michael, this is great. I tanked my dev site in prepping for the October SSL requirements for Chrome, but I’ll have to get it up and running and give this a shot. I hope you release 2.0.2 soon!
Michael, you rock. I’ve deployed the changes to the APIv2 file and even with the 337 forms it works like a champ. You should totally update the plugin to include that for everyone else.
I did notice that our list of forms didn’t seem to automatically update without the manual refresh cache click, what is the refresh time? I created a form yesterday and it didn’t appear overnight in my list. I refreshed the cache and it appeared immediately, so it’s not a big deal just wondering if I have to manually refresh everytime or what I should expect.
Looks like we don’t presently have an automatic refresh mechanism in place. There can be considered benefit there, in that it’s not calling external things regularly, potentially slowing down the site at times. However, I can wholeheartedly understand why someone wouldn’t want to have to manually refresh themselves each time. We’ll definitely keep it in mind as part of a future release.
That said, good to hear things are working splendedly for you with your deployment.
I understand, it does take some time holding up the site. If you do set an automated refresh, please allow for a time-set, i.e. we would set it in the 3-4 am range.
I did notice your reviews, you had some outdated 1 star reviews that you may follow up with. Anyhow, I bumped up your rating by 0.2 by 5 starring my previous review.