WooCommerce – APG SMS Notifications – Add Mvayoo

This sparked off after a mail by a colleague turned out with a very quick reply by the original authors. The nutshell was that “We’re sorry, but we can’t spent more free time with our plugins”. Well that is quite justifyable. But the donation requested was way too much for our considerations. And today morning I just sat down with an insight to look deeper into the original code by Art Project Group. Thanks to the Google Translator, and the wonderful code by the Art Project Group. Should not forget the contributions of one of my old colleague Niju NB, for creating the mVaayoo api as a php class. The whole integration took less than 15 minutes with all the available peripherals.
Continue reading “WooCommerce – APG SMS Notifications – Add Mvayoo”

PHP MyProfiler as a WordPress Plugin

The profiler and sampler has been bundled into a single download, but is now two wordpress plugins. Though this has issues that this will be plugged into the wordpress flow after init and that logging is done on shutdown hook, some of the database calls are never logged. Still that is not an issue as mostly slowness would be caused by database calls from the theme and plugins. Note that logging may make system more slow and this is for identifying the bottlenecks and should never be left on for long times. Features like Log requests from IP, Log requests from IP to specific URL, Enable/Disable, Log Frequency are in the wishlist. Currently when you enable, the profiler starts logging, and creates new file for every hour. This is stored into the UPLOAD_DIR/wp_php_my_profiler with <Year-month-date-hour>.log as filename, and posted into the $wpdb-posts table with post_status = private, and post_type = profiler_log, Once logging is done, and before going for analysis, better deactivate the Profiler. Log Analyzer creates a menu entry in the admin side, and shows the logs from the $wpdb->posts table with the above properties in a tabular form, with actions ‘Analyze’ and ‘Delete’. The plugin is provided for advanced users and debuggers to find issues and bottlenecks in their plugins or themes. Download the plugin Download

bz2url – a very simple url compressor for wordpress

Its been over a year since we started bz2.in url compression for inhouse projects at Saturn and is being in use for Asianet India and this blog. Recently for a new project we absolutely needed an integrated url shortner, which finally gave shape to the initial version.
Continue reading “bz2url – a very simple url compressor for wordpress”

WordPress – preview and modify a theme till we are satisfied

Since we at Saturn provide wordpress as a CMS, and have more than a handful of experienced WordPress customizers, and themeres we have handled several challeges related to WordPress. The latest one being that the client was offered a facelift, and they wanted to preview the progress of integration. I searched the plugin repositories and blogs, found a lot of solutions, which include theme switchers, theme preview, and even suggestions to have a local copy. Well with our client, we could not think of a local copy, since the database dump itself was about 320GB and the images and videows was a whopping 1200 GB. Well after reading through the source of get_option, a wave struck me.

function new_theme_preview(){

I added the above to the end of an active plugin, then created two files newtheme.php and oldtheme.php, containing code to set and remove the cookie. The files were put into the top level folder. Once I am done with the theming, I could remove all these manually.

// newtheme.php
setcookie 'ShowNewTheme''1');
header("Location: ./");
setcookie 'ShowNewTheme'false);
header("Location: ./");

JSON feed for WordPress

Pretty simple, really. Adds a new type of feed you can subscribe to. Simply add ?feed=json to anywhere you get a normal feed to get it in JSON form (but with a cutdown version of events).

Version 1.1 added support for JSONP. To get a JSONP response instead of a normal JSON structure, simply add jsonp=callbackName to your query, where callbackName is the name of the function to be wrapped with.

Author: Chris Northwood
Download: WordPress Plugin Repository

WordPress object caching in file system

During the past couple of months, since we are maintaining a heavily loaded wordpress implementation, Kerala News Portal for Asianet, distributed across two servers, and having a daily visit of 50K, I was on the hunt for better caching and optimizing techniques. On the move, I happened to read the article by Jeff Starr, written some 15 months ago, and all the associated comments. It was sad to see that the file based cache was removed from wordpress, due to several reasons though.
After reading through this, I saw the official Function Reference for WP Cache, and the eAccelerator for WordPress by NeoSmart Technologies. Reading through the code written by Computer Guru of NeoSmart Technologies, tickled me and I just modified some parts, by pulling out the eaccelerator specific functions, and switching to a file system based store. I am not adding the code as pretty php code. Drop the file into wp-content, create a cache folder in wp-content and chmod folder to 755.
Recently only I found that this has been outdated with new version of wordpress demanding more of the wrapper functions and capabilities. And this has been brought into the system. Functionally more or less the same, but will work on shared hosting for just object caching.

JavaScript Aggregate; WordPress plugin

Collects all different linked javascripts and replaces with a combined single script, optionally compressed. Based on code originally written by David Holmes, Martin Kliehm, Gaetano Giunta. Uses the PHP adaptation of JSMin, published by Douglas Crockford as jsmin.c, also based on its Java translation by John Reilly.

After reading about Website Performance Tweaks, and a lot of other blogs and slides, I thought about how to cook up a javascript aggregate plugin for wordpress. The out come is wp-jsmin. Though this is in its infancy, it is being used in this blog, to combine all linked javascript to a single link, thereby reducing server requests. This code is still in the testing stage, and may break if the used scripts do not pass lint checks. I am planning to shift all the options to a options page in the wordpress admin page.

Those who are daring enough could download and try. Please put a comment here if you are using this on your wordpress. And for others who would like professional help, I would be most pleased to extend my services through RentACoder. Or for a whole dedicated wordpress team to design, build and maintain sites like Kerala News, Cirrus Travles or Rajeev Gandhi Center for Biotechnology, send an inquiry to Saturn.


Distributed Media; a WordPress Challege

Though when the team at Saturn decided to build kerala online, on wordpress, they were quite confident, the complications started to get under their skins when the first wave hit the portal and at a point were the portal was being run from a single server and reached about 35K visits per day. The server was running on apache with about 2G Memory and hosted in Asianet the ISP division. There was times when the server was running at load averages above 60. All workarounds were getting futile, and there was certain times, like evening and early morning when the server hits the upper limit and ceases to respond. Continue reading “Distributed Media; a WordPress Challege”

Get Post Image for WordPress

Get Post Image is a plugin for WordPress 2.0 and higher that allows you to retrieve images contained in posts and display them in a custom manner.

Though the plugin helps you do all that what is said, it had a small bug (or was it intentional), will need to ask Andrew. The problem was identified only after we implemented it in the Asianet Portal – Kerala Online. With about 10K hits a day, the whole process was loading our web server which was a Dual Xeon with 4G RAM. I found it really baffling, and went on a wild hunt, and identified a lot of about 15 to 20 internal requests per external request of a page.

The hunt finally came to the place where the problem was on line no 252,
$imagesize = @getimagesize($img_url);,
which was changed to
$imagesize = @getimagesize($img_path);.

And the server started to breathe again.