I won’t get into all of the details of why I needed this functionality, but I was working on developing an online payment process using Gravity Forms and Authorize.net and the accounting office requested a very, very specific reporting format.
After developing a convoluted system using Google App Scripts to combine, archive, package, and delivery this data on a daily basis from multiple forms on multiple sites – the accounting office requested the CSV data also be merged with transaction data from Authorize.net. It would save them significant amounts of time. (Also, Google App Scripts are REALLY amazing for managing and automating documents and spreadsheets.)
Unfortunately Gravity Forms payment add-ons store payment data in a separate table and then simply call it when you view and entry in the dashboard, but it’s not accessible from the regular GFAPI entry object. Sigh.
So here’s what I came up with. Hopefully another poor soul may find it useful…
After a couple of years of hearing how HHVM was dominating other installations in speed tests, I was please when earlier this year, PHP7 was finally release. Zend claimed similar (or even greater) speed gains. But the proof is in the pudding, yes?
So I set off to install and test PHP 7 on my own hosted VPS – which I recently upgraded to CentOS7 and Easy Apache 4. After months of waiting, the folks at cPanel finally released support…
Unfortunately yum install ea-php70 only installs the most basic modules to the server. You’ll need to go through an find all of the modules built for PHP7 and Easy Apache. At the moment, the only method I know of identifying which modules are available is to view them through WMH (Home >> Software >> EasyApache 4). Then you can install them via command line like so… yum install ea-php70-php-gd.
So here’s the before on a site running on PHP 5.6 no caching or CDN applied.
And here’s the after with the same site running PHP 7.0 with no additional configuration of any kind.
NOTE: I had to install ea-php70-php-pdo and ea-php70-php-mysqlnd to get MySQL to work with PHP7. mysql() is deprecated in PHP7 and any plugins that rely on it will throw errors as well.
That’s a full second off and and a 43% speed increase. Sweet!
I was working to create a system that allowed users to submit a Gravity Form entry with multiple file attachments that would create a post on the front end, printing those attachments. GF and the wonderful Gravity Forms + Custom Post Types plugin makes it easy to map a form field to a custom meta field (new or existing) – however I ran into a snag when trying to display multiple file uploads. Simply echoing get_post_meta was just returning one of the meta field values, not each value.
Create a simple loop that stores each of the meta values to a variable, then loop through each echoing out the file links. This loop will need to be added to the post content either via theme template, filtering the_content(), and adding it onto a hook. With this particular project using Genesis, I added it to the genesis_entry_content hook.
A really cool function used in the snippet above is basename(). It’s a simple php function that takes a string for a file path (in this case a url) and just grabs that filename at the end of the string. Pretty cool and way simpler than some regex solution.