Having detailed logs of how your services are being used is important, but sometimes it’s nice to have immediate notifications of critical events. Enter Notifo, the super-easy-to-use push notification service.
We recently updated WP-Logs to support the Notifo service so you can now receive notices just about anywhere. We have some of ours going straight to phone, email, and growl.
WP-Notifo is required and must be configured properly. After you’re all setup, use it with WP-Logs by adding the ‘notifo’ key to your event call; i.e.:
$EventLog = new EventLog(array(
'event' => 'New post',
'text' => 'A user created a new post',
'notifo' => true
When building a new application or plugin, sometimes its important to have detailed information about what actions are taking place. This can be crucial when testing APIs, hooks, and your users actions to make sure your design is having the desired effect.
In the course of creating, testing, and debugging our work at Shockoe, we’ve created a WordPress plugin that gives you the ability to track custom events and pass along any information you need. WP-Logs (catchy title, right?) lets you drop a single line into your plugin code to define an event title, user id, and any extra information you’d like to see. This information will appear under a new ‘Logs’ tab in the WordPress admin panel and can optionally be passed to a Google Analytics account to be viewed inline with your other site statistics.
It’s currently being reviewed by the WordPress staff and will be available soon in the official WordPress Plugins directory. For now, the plugin can be cloned from our github repository. Follow us on twitter at @shockoe for information and updates.
The benefits of using Amazon S3 to store static resources is alreadywelldocumented. It’s almost a no-brainer if you are building an app that hosts a lot of static files.
We just converted an app that we’re working on to use S3 for all user uploads. It not only sped up our development time, it also basically eliminated the need to worry about file-server scaling in our prototyping stage. And we may not need to worry about it for a quite a while after that.
Check out http://getcloudfusion.com/ for more information on the Amazon S3 SDK for PHP.
One of the major features to be introduced in WordPress 3 was the ability to create custom post types. Basically, this lets you recreate the ‘Posts’ tab with specific functionality in mind. For example, creating a portfolio with fields for project images and client information. At Shockoe, we are using this in an upcoming project to that uses WordPress to provide content for a new iPhone app.
This makes WordPress much more viable as a CMS as opposed to blogging software that struggles to handle larger sites. In previous versions of WordPress this involved either a considerable amount of work or using a massive plugin. The best of those plugins, Magic Fields (a fork of Flutter), is several thousand lines of code. We can create a flexible solution in far fewer lines.
Here we have created a new post type that will have it’s own sidebar tab under ‘Posts’ as well as fields for title, content (‘editor’), an excerpt, and comments. We also added functionality similar to WordPress’ tags and categories features by calling ‘register_taxonomy.’ Setting ‘hierarchal’ => true will make the field behave like categories while leaving it empty (or setting it to ‘false’) gives us the tags functionality.
That’s it. Simple. In a handful of lines we have a flexible solution that gives us the option of using better contextual grammar. That translates to a much better experience for clients and end users.
Adding Custom Functionality
The code above basically replicates the Posts functionality with the ability to have better labels. But what if we need to include custom information? For that we need add_meta_box:
add_meta_box("example_field", "Example Text Field", "example_field", "normal", "high");
Now we should have a custom text box that will appear below the content editor. When we save our post, the information in our custom field will be saved to the database. And when we edit our post, the text field will be repopulated.
With a little bit of coding knowledge you can create an elegant solution for turning WordPress into a functional CMS. And this is a very basic example; the possibilities of what can be created from this point are endless.