Tag Archives: Plugin

Email Log WordPress plugin v1.9.1 released

Just a quick note to let you all know that I have released v1.9.1 of my Email Log WordPress plugin that allows you to log every email that is sent from WordPress.

This released fixed a minor security bug that allows logged-in unprivileged users to view content of the logged email.

Since it is a security fix, it is a mandatory update.

Continue reading »

Posted in WordPress | Tagged , , , | 1 Comment

Email Log WordPress plugin v1.9 released

I just released version 1.9 of my Email Log WordPress plugin. This released fixed an issue with pagination while viewing log files and various improvements at code level.

About Email Log WordPress plugin

Email Log is a WordPress plugin that allows you to log every email sent through WordPress and provides a UI where you can view them. The logged emails can be searched based on date, email address or subject.

Continue reading »

Posted in WordPress | Tagged , , , | 4 Comments

Easy Retweet WordPress plugin v3.1 Released

As I promised in my year end review post, I have started working on my WordPress plugins. My Easy Retweet WordPress plugin badly needed an update to fix a couple of warnings and I just released v3.1 of the plugin with a couple of fixes and some new features.

About Easy Retweet WordPress plugin

Easy Retweet WordPress Plugin that allows you to easily add Twitter tweet buttons to your WordPress posts.

You can choose to add these buttons using any one of the following ways

  • Automatic way – Just configure the button in the settings screen
  • Using shortcodes
  • Using template functions

You can also enable Google Analytics tracking for the links that are generated by buttons created by this plugin.

Continue reading »

Posted in WordPress | Tagged , , , | Leave a comment

Github Ribbon Plugin v1.2 release

I just released v1.2 of my Github Ribbon Plugin.

About Github Ribbon

Github Ribbons is a WordPress Plugin that allows you to add “Fork me on Github” ribbons to your WordPress posts or pages. You can enable the ribbon per post/page level or at global level.

Continue reading »

Posted in WordPress | Tagged , , | Leave a comment

Easy Retweet Plugin v3.0.3 release

I just released v3.0.3 of my Easy Retweet WordPress plugin.

About Easy Retweet WordPress plugin

Easy Retweet WordPress Plugin that allows you to easily add Twitter tweet or bit.ly buttons to your WordPress posts.

You can choose to add these buttons using any one of the following ways

  • Automatic way – Just configure the button in the settings screen
  • Using shortcodes
  • Using template functions

You can also enable Google Analytics tracking for the links that are generated by buttons created by this plugin.

Continue reading »

Posted in Plugin Releases | Tagged , , , | Leave a comment

Year End Stats Plugin v1.0 release

I just released v1.0 of my Year End Stats WordPress plugin just in time for you to write your year-end review posts.

This release adds a lot of new features and is a mandatory update.

Continue reading »

Posted in Plugin Releases | Tagged , , , | Leave a comment

WP Github Gist plugin now supports the new Gist API

Like my Twitter Avatar plugin, even my WP Github Gist plugin was broken recently due to changes in the underlying API that my plugin was using. This time it was because of the changes in the Gist Embed API.

Continue reading »

Posted in Plugin Releases | Tagged , , , , , | Leave a comment

Twitter Avatar plugin now supports the new Twitter API

Because of the recent changes in Twitter API, my Twitter Avatar Reloaded WordPress plugin stopped working. I rewrote the way my plugin communicates with Twitter and updated the code to use the new API and now my plugin works again.

New Twitter Backend

Instead of rewriting the entire Twitter backend again, I am not using the excellent wp-twitter-api, provided by @timwhitlock which allows you to easily communicate with Twitter API from your WordPress plugin.

If you are a WordPress plugin developer and want to communicate to the Twitter API from your WordPress plugin, then I would highly recommend you to use wp-twitter-api, instead of creating your own.

Setting up Twitter App

The new version of the Twitter API needs you to make authenticated calls even to get some basic information about a twitter screen name. So after you installed the plugin you need to follow these steps so that the plugin could interact with the Twitter API.

  • Register a Twitter application at https://dev.twitter.com/apps
  • Note the Consumer key and Consumer secret under OAuth settings
  • Log into WordPress admin and go to Settings > Twitter API
  • Enter the consumer key and secret and click ‘Save settings’
  • Click the ‘Connect to Twitter’ button and follow the prompts.

Download

This is a mandatory update. You can download the latest version of the Plugin from the Plugin’s homepage or install it using the Plugin installer.

Feedback

Please keep the feedback coming and if you want me to add any new features or find a bug, please leave a comment or post about it in twitter.

Posted in Plugin Releases | Tagged , , , | Leave a comment

How To Properly Create Tables In WordPress Multisite Plugins

Recently, I added full WordPress Multisite compatibility to my Email Log WordPress plugin and during the process, I learned a lot about how to create and handle tables in WordPress Multisite plugins. I thought of documenting it here so that it would be useful for other plugin authors.

Creating tables in Single site installations

Before we get into WordPress Multisite, first let’s see how we can create a table in a single site WordPress installation. You have to hook into the register_activation_hook action, which will be called every time you activate your plugin and then check if your table exists or not. If it doesn’t exist, then you can create your table.

The following code shows how you can do it.

The above code will work even in WordPress Multisite installations, if your plugin will be activated individually for each blog. But if your plugin is networked activated, then the above code will create the table only for the primary blog.

Creating tables for all blogs in a WordPress Multisite installation

Now that we know how to create the table for a single blog, let’s see how we can create the table for all the blogs in a WordPress Multisite installation. Even in this case, we have to hook into the same register_activation_hook action, but should loop through all the blogs in the network.

The following code shows how you can do it.

Creating table when a new blog is created

The above code will create the table only for the blogs that were created before the plugin got network activated. We should also make sure that we create the table for every new that gets created. In order to do that we can hook into the wpmu_new_blog action.

The following code shows how you can do it.

Deleting the table when a blog is deleted

Now that we are creating the table for every new blog, it is our job to make sure that the table is deleted when the blog is deleted. In order to do that, we can hook into the wpmu_drop_tables filter.

The following code shows how you can do it.

Querying the correct table

When we are querying the table, we should always use $wpdb->prefix . $table_name. If we do that, then WordPress will automatically query the correct table based on the current blog. We don’t have to manually find out the blog id and add it to the table name.

Now your plugin should be completely compatible with WordPress Multisite 🙂

Alternate approach

If you look into the above code closely, you will notice that we are creating one table for each blog in the network. For most WordPress Multisite installations, this shouldn’t be a problem. But some WordPress Multisite installation may have thousands and even hundreds of thousands of blogs. In those cases, we might end up creating huge amount tables which might become a bottleneck. Also my plugin needed just one table. Some plugins might need more than one table, which might also increase the number of tables that gets created.

One alternate approach is to create just one table for all blogs and then separate out data for each blog using a blog_id column. While querying the table, we can filter out based the blog_id column.

If I had started my plugin from scratch, I would have done that instead of creating separate tables.

Update: As Damian pointed out below in the comments, if you are using this approach, then you used use $wpdb->base_prefix to get the main prefix and not the individual sites prefix.

Removing the tables when the plugin is deleted

The other thing to keep in mind is that we should delete all the tables when the plugin is deactivated and deleted. I will write a separate article explaining how we should do that.

With WordPress Multisite becoming more popular these days, I hope this information was useful to you. Do let me know if you have any question or comments. Also you can checkout the entire code of my Email Log plugin in github.

Posted in WordPress | Tagged , , , | 20 Comments

Email Log plugin is now fully WordPress Multisite compatible

I just released version 1.7 of my Email Log WordPress plugin, which adds full compatibility with WordPress Multisite.

About Email Log WordPress plugin

Email Log is a WordPress plugin that allows you to log every email sent through WordPress and provides a UI where you can view them. The logged emails can be searched based on date, email address or subject.

WordPress Multisite compatibility

Earlier versions of Email Log plugin had some compatibility with WordPress Mu (older version of multisite), but I didn’t test it for long time. Also when WordPress Mu got merged into WordPress core, certain things have changed and my plugin was not fully compatible after that.

I came to know about it recently and then started to work on it to make it fully compatible with WordPress Multisite, since I have moved this blog to WordPress Multisite as well. I also learned a lot about WordPress Multisite during the process and will write a separate blog article about it soon. Update: As promised, here is the new blog article explaining how to properly create tables in WordPress Multisite plugins.

Dev Time

This release took me about 2.5 hours of development time. You can find more details about the dev time tracking which I have recently started doing in a separate blog post.

Download

You can download the latest version of the Plugin from the Plugin’s home page.

Feedback

Try out the Plugin and if you have any comments or if you want to report any bugs, please leave a comment below.

Posted in Plugin Releases | Tagged , , , , | 1 Comment