WPMU.orgPlugins | WPMU.org http://wpmu.org WordPress, Multisite & BuddyPress plugins, themes, news and reviews and special offers from the team at WPMU.org Wed, 22 May 2013 20:15:39 +0000 en-US hourly 1 http://wordpress.org/?v=3.4.2 Don’t Fall Prey to Hackers With This Super Secure Tip http://wpmu.org/wordpress-force-strong-passwords/ http://wpmu.org/wordpress-force-strong-passwords/#comments Mon, 20 May 2013 15:30:54 +0000 Joe Foley http://wpmu.org/?p=115395 As the WordPress platform becomes more and more popular, it also becomes a more popular target for hackers, like the surge in attacks that took place just a month ago.

Of course there are a number of very basic things you can do to help protect yourself:

  • Always update to the latest version of WordPress
  • Keep your theme(s) updated
  • Keep your plugins updated
  • Don’t use “Admin” as your administrator login
  • Use strong passwords

All of those suggestions are well within your control, of course. But there’s one situation that can throw a wrench into that control. If you have others registering on your site, then they can chose to change their password to one of their own.

Use a Plugin to Force Strong Passwords

In order to address this situation, you can use a plugin such as the Enforce Strong Password plugin.

There aren’t a lot of controls – just the ability to choose the required password strength between 1 and 4. The default is set to 4, and so if that’s good with you, you don’t have to touch anything.

If a user attempts to update their password with one that isn’t strong enough for the plugin, it shows the following message:

If you would like require stronger passwords for only those with a user level of Author and above, then the Force Strong Passwords plugin will do the trick.

Photo: login password from BigStockPhoto

Related posts:

  1. Apocalypse Meow Protects Your WordPress Site From Hackers Here's a quick tip to help you protect your WordPress...
  2. Secure all WordPress logins with HTTPS even if you don’t have your own SSL certificate A plugin that allows you to force all WordPress logins...
  3. 3 Sneaky Tricks Hackers Use to Target WordPress Sites If you want to keep hackers from hijacking your WordPress...
]]>
http://wpmu.org/wordpress-force-strong-passwords/feed/ 0
Merge WordPress Tags Easily and Quickly for a Leaner, Better Site http://wpmu.org/merge-wordpress-tags/ http://wpmu.org/merge-wordpress-tags/#comments Thu, 16 May 2013 20:26:48 +0000 Joe Foley http://wpmu.org/?p=115366 In a way, tags in WordPress are like categories. They are meant to group similar topics together in a way that makes them easily accessible (i.e. by clicking on a tag link and seeing all the posts marked with that descriptor).

The problem a lot of people run into is that they end up assigning too many tags to their posts. This defeats the purpose of tags. If you only end up with one or two posts with that tag, it hardly deserves its own “category.”

As mentioned, tags are somewhat like categories — but just a little more specific. For example, here at WPMU, we obviously don’t think the term “tags” is big enough or important enough for its own category. However, I am going to tag this post “tags” because it seems like an important enough/big enough topic that other posts will also touch on it some significant way.

I’m NOT, however, going to tag this post “merge tags.” That topic isn’t large enough to have a significant number of other posts that talk about that.

To be honest, I might have done that in the past, but we’ve come to realize it’s not really that valuable. And so we’re actually in the middle of cleaning up our “tag problem” by deleting many and merging the rest.

If you’ve got a tag problem too, read on.

How to Merge Your Tags

In order to help you merge your tags, I’m going recommend you use a plugin called Term Management Tools.

Once that’s installed, you’ll need to hop on over to your tag screen (Posts > Tags).

Get Rid of Unused Tags

Probably the very first thing you should do before you start merging is to start deleting. You may find a number of tags will be hard to merge with others. You might also find that somehow you’ve ended up with tags that aren’t assigned to any post at all.

On your tag page, if you click on the “Posts” link on the right, it will arrange your tags by the number of times they’re assigned to a post. I’d start by checking the box for all the ones that say “0” and then using the pull-down menu at the top and deleting them.

Get Rid of “Difficult” Tags

You can then start looking down through your other tags and seeing if there are any you know you can delete right away – i.e. tags that not many posts use and that will be difficult to merge with others. Again, the best candidates here will be the ones that are assigned to only a few posts.

As before, check the box next to the name of the tag, and then use the pull-down menu at the top.

If you have a large number of tags, you may want to increase the number you can see on one screen by pulling down the Screen Options panel at the top and bumping that number up.

Merge Remaining Tags

Assuming you’ve got the Term Management Tools plugin active, you can now get to merging your tags.

Go through your remaining list and check all those that should be merged together into one term.

In my example, I am checking the tag “blue” and the tag “blue things.” From the pull-down menu at the top, I choose “Merge.”

When I choose “Merge,” another box appears just to the right of the pull-down menu. I simply write the name of the tag both of those tags will be merged into. In my case, I’m writing in the name “blue.” But you don’t have to write the name of an existing tag here. You can write the name of a completely new tag.

Click “Apply,” and your tags will be merged.

If you have a lot of tags, this process may take a while, but it will be worth it in the end. It will be better for your users, and you can give up the tag addiction that so many of us are afflicted with.

(Note: Once the job is done, you can delete this plugin from your site. No use keeping unused plugins around.)

Photo: Red Tag from BigStock

Related posts:

  1. Featured WordPress Plugin: Simple Tags This week I’m going to look at some plugins that...
  2. How to Merge Categories in WordPress No plugin necessary - check out this quick guide for...
  3. 11 Ways to Make Your WordPress Site Faster and Leaner Is your site slow? Does it it crawl at a...
]]>
http://wpmu.org/merge-wordpress-tags/feed/ 2
MailChimp Killer? WPMU DEV’s new WordPress email newsletter plugin does it all! http://wpmu.org/brilliant-wordpress-email-newsletter-plugin/ http://wpmu.org/brilliant-wordpress-email-newsletter-plugin/#comments Thu, 16 May 2013 15:30:10 +0000 James Farmer http://wpmu.org/?p=115332 We’ve been in the business of releasing WordPress email plugins for a while now, but nothing comes close to this… introducing the all new e-Newsletter, we think you are going to love it.

We’ve put everything we can into this to provide you with a truly professional email newsletter setup, including pretty much everything you could require:

  • Super easy setup and configuration
  • Beautiful, fully customizable templates
  • Along with a great template builder
  • Powerful user management (including import)
  • User groups & group management
  • Detailed informative reports
  • Cracking widget interface and behavior
  • SMTP much improved
  • Add user data to newsletters
  • Display emails in browser
  • Shortcodes galore
  • New hooks to integrate with other plugins
  • And much, much more
  • With amazing support and usage docs, if you need them

And of course as it’s a WPMU DEV plugin it’s guaranteed to work, guaranteed to be updated and comes with guaranteed support.

Not bad huh :) Let’s take a look under the hood…

The template builder is just like editing a theme in WordPress, in fact it’s identical :)

Couldn’t be easier to build an email template, right in WordPress

And of course the plugin comes with a bunch of pre-built, gorgeous templates for you pleasure, for example:

A nice clean minimal template
A dark background, for you hackers out there ;)

And here’s one of my personal favorite features, adding and managing users and groups:

Easily add and manage and import individual and batches of email

And of course logged in users (for example, on Multisite or BuddyPress installations) can easily manage their email subscriptions via the widget, yum:
Users can easily manage their subscriptions

And there is so, so much more… in fact here’s that video again if you missed it the first time round, 60 seconds and you’ll be convinced.

We’ve been working on email functionality for WordPress for years, for example there’s Subscribe by Email, Mass Email (old skool MU!), BuddyPress Group Email and Automessage (drip email), but we reckon this is the best of the lot, by a long way.

Download e-Newsletter here, woohoo!

Photo credit: Today is a good day

Related posts:

  1. MailChimp email newsletter WordPress MU integration! Did you get our Useful WPMU Links newsletter? If so,...
  2. Aweber vs. Mailchimp: Which is the Best Email Newsletter Service? Comparing the two most popular email building services and seeing...
  3. Send HTML Emails with WordPress and the e-Newsletter Plugin We’re very excited to introduce our brand new e-Newsletter plugin...
]]>
http://wpmu.org/brilliant-wordpress-email-newsletter-plugin/feed/ 25
Free Global Product Search Widget For MarketPress http://wpmu.org/marketpress-global-product-search/ http://wpmu.org/marketpress-global-product-search/#comments Fri, 10 May 2013 15:30:58 +0000 Sarah Gooding http://wpmu.org/?p=114791
MP Product Search Widget
We’ve got some great community members at WPMU DEV who are building awesome extensions to our products. The very latest is a free plugin from MarketPressThemes.com that provides a beautiful interface for searching and sorting products across a network of stores.

Solid multisite compatibility is one of the reasons that MarketPress is so popular. There is no better WordPress e-commerce plugin for operating multiple stores with one global shopping cart. This new extension compliments MarketPress’ built-in multisite capabilities.

The MP Product Search Widget plugin features:

  • Advanced Product Search Options – narrow down the search through different parameters, such as category, tag, and price range.
  • Compatible with Multisite for Global Searches – allow customers to make global product searches across your MarketPress network – just like Etsy.com does it.
  • Built to Impress – display all the search results in a nice, beautiful modal view, together with product thumbnail, price, and ‘buy now’ button for each item.
  • Advanced Sorting Options - allow your customers to sort the search results based on different parameters, such as release date, title, price, sales.
  • Powered by AJAX – perform high-level search queries without crashing the server.
Product search results load in a modal window

Multisite Compatible: Global Product Search Widget

Global product search widget options
The MP Product Search Widget plugin also includes a separate widget for multisite installations that gives users the ability to search the network. This functions in a similar way to Etsy.com searches across multiple stores.

Configuration options are the same as the single store search widget. The only difference is that it searches all stores.

Options for the widget include:

  • Show or hide category filter
  • Limit to custom categories
  • Show or hide tag filter
  • Limit to custom tags
  • Show/hide price range
  • Choose from 7 different color skins
  • Limit visibility to store pages only

Want to try out a live demo of the search to see how it works? Check out the search widget on any of these themes:

Live Demo: FlexMarket | PRO | GridMarket | SimpleMarket | Twenty Twelve

Download MP Product Search Widget for Free

There are a couple of different avenues for downloading the plugin – either way it’s free. The first option is to visit MarketPressThemes.com and create an account. Then you can proceed to the user dashboard to download the plugin. The plugin is also available at github if you want to grab the zip file directly. Many thanks to the folks at MarketPressThemes.com for making this plugin available for free.

Related posts:

  1. Global Search for WordPress MU and BuddyPress One of the things we’ve been asked a lot for...
  2. WPMU DEV MarketPress 2.0 Released – Now with Downloadable Products, Global Carts and Much, Much More! Yes, that’s right, it’s the one you’ve all been waiting...
  3. Add a Search Widget to Your bbPress Forum New widget lets you search forum/forums, topic/topics and reply/replies within...
]]>
http://wpmu.org/marketpress-global-product-search/feed/ 0
Add Privacy Controls To The BuddyPress Activity Stream http://wpmu.org/add-privacy-controls-to-the-buddypress-activity-stream/ http://wpmu.org/add-privacy-controls-to-the-buddypress-activity-stream/#comments Wed, 08 May 2013 20:15:30 +0000 Sarah Gooding http://wpmu.org/?p=114733 New BuddyPress plugins are being released just about every day, and once in awhile there’s one that stands out with the potential to be universally useful. That’s the case with the new BuddyPress Activity Privacy plugin. It gives users the ability to restrict who can see their activity posts.

Once installed and activated, BuddyPress Activity Privacy adds the following privacy controls to the post update box for members:

  • Anyone
  • Logged In Users
  • My Friends
  • Admin Only
  • Only Me

Why anyone would select the “only me” option, I can only guess. Perhaps it’s a decent alternative for those who like to vent on social networks. “My Friends” privacy option puts the BuddyPress core friends component to good use, making it worthwhile for users to send and accept friend requests.

Privacy controls added to the activity update box

Certain privacy controls are component-dependent. For example, the “Friends Only” privacy option in the dropdown will not show up unless you have the Friends component activated in the BuddyPress settings panel.

When posting within a group the group-specific privacy options will be added to the dropdown, inlcluding:

  • My Friends in a Group
  • Group Members
  • Group Moderators
  • Group Admins
Group-specific privacy options

In the past, the lack of privacy controls has turned many people off to using BuddyPress. This new plugin should help to alleviate some of those concerns, since most of the content flows through the activity stream and group components. I’ve tested the various privacy controls and they all seem to work just as advertised. The BuddyPress Activity Privacy plugin is one I would recommend for any BuddyPress site. It gives each member multiple privacy options on activity posts and should encourage more confident participation on your social network.

Related posts:

  1. A Look at the Present and Future of the BuddyPress Privacy Component Jeff Sayre announced today that BP Privacy v1.0-RC1 is now...
  2. Download the New BuddyPress Profile Privacy Plugin Need basic profile privacy for BuddyPress? This free plugin has...
  3. Create a Better Community Experience With the New BuddyPress Friends-Only Activity Stream Plugin All the credit for this plugin goes to Rich Fuller...
]]>
http://wpmu.org/add-privacy-controls-to-the-buddypress-activity-stream/feed/ 3
How to Make a Command Line for Your WordPress Site http://wpmu.org/wordpress-command-line/ http://wpmu.org/wordpress-command-line/#comments Mon, 29 Apr 2013 15:30:56 +0000 Jarred Kennedy http://wpmu.org/?p=113702 Are you that level of WordPress user that could use the WordPress back-end blindfolded (figuratively of course)? You know – that user who is so fluent that doing simple tasks in the administration panel are irritating because it’s too slow? That user who maybe knows HTML and possibly even CSS but doesn’t want to venture into hardcore coding?

Well, I was that user, and after a little time snooping around in the codex, I devised a solution to quench my thirst for more WordPress power: a simple in-house plugin that adds a command line to the back-end. And in this post, I’m going to show you how to make it.

What You’ll Need for this Tutorial

  • A code editor (for simplicity I recommend: Notepad++ – Windows, TextWrangler – Mac)
  • A method of compressing folders to .zip extension (I recommend: IZArc – Windows, iZip – Mac)
  • A WordPress site
  • The ability to upload and activate plugins in the WordPress back-end
  • Absolutely NO coding knowledge (though it wouldn’t hurt to know a bit of HTML and CSS)

The Concept

The concept of a command line for WordPress has been thought of before. The difference is the existing plugins use syntax nearly identical to a real computer command line.

This command line’s syntax is more human friendly allowing you to easily memorize the commands you want to run, making it more convenient and less confusing.Furthermore, this tutorial will provide a cognitive learning opportunity that will allow you to become more fluent with the code side of WordPress.

The Goal

The end result is to be a command line for WordPress in the form of a plugin. The purpose of the command line is to provide you, being a WordPress webmaster, with a less tedious means of performing day-to-day tasks. The plugin will be extensible to leave the door open for more functionality.

Lets Get Started

Step 1 – Preparing your development environment:

Download the project JavaScript, CSS and images here (3KB – etc.zip)

The files will be in the archive “etc.zip.” Extract them. (If you do not have archiving software, there are links to free ones at the beginning of this tutorial.)

Create a folder anywhere on your computer called “CommandLine.” This will be the folder that consists of our plugin.

Place the “etc” folder, of which you’ve extracted from “etc.zip,” inside the CommandLine folder.

Step 2 – Coding the core

The following code is the header information that is required in every plugin as it gives WordPress all the information it needs to know about the plugin. Go ahead and copy & paste this code into your code editor and save the file to the CommandLine folder as ‘CommandLine.php’. You can change the information to your details as per the file headerguidelines provided by WordPress.

1
2
3
4
5
6
7
8
<?php
/*
Plugin Name: Command Line
Plugin URI: http://your-website-URL
Description: A command line utility for the WordPress guru
Author: Your Name Version: 1.0
Author URI: http://you-website-URL
*/

The segment of code we’re going to be adding will ensure that our plugin cannot be called directly via a URL. Add the following to your code editor underneath what you’ve already added.

1
if ( !defined( 'ABSPATH' ) ){ exit(); }

This next piece of code is going to load our plugin class. We are using object orientated programmingto keep our code organized. Add the following to your code editor.

1
include(realpath(dirname(__FILE__))."/class-console.php");

Now on to functions. The first function we are going to write will make sure our JavaScript is present when we are on our plugin page.

1
2
3
4
5
6
7
8
9
function CMDL_scripts(){
// ensure that our JavaScript only runs on our plugin //
if( isset( $_REQUEST['page'] ) AND stripos($_REQUEST['page'], "console-") !== false):
// Register our JavaScript and pass jQuery as per the WordPress Codex //
wp_register_script( "CMDL_SCRIPT", plugins_url()."/CommandLine/etc/main.js", array("jquery"));
// Enqueue our JavaScript and terms //
wp_enqueue_script( "CMDL_SCRIPT" );
endif;
}

Now we do nearly exactly as we just did except this time including our CSS stylesheet.

1
2
3
4
5
6
7
8
function CMDL_style(){
// ensure that our CSS only runs on our plugin //
if( isset( $_REQUEST['page'] ) AND stripos($_REQUEST['page'], "console-") !== false):
// Register our JavaScript and pass jQuery as per the WordPress Codex //
wp_register_style( "CMDL_STYLE", plugins_url()."/CommandLine/etc/style.css");
// Enqueue our JavaScript and terms // wp_enqueue_style( "CMDL_STYLE" );
endif;
}

Now we’re ready to add the code that actually adds the plugin to the WordPress back-end. We’ll be registering a custom menu page as opposed to appending a settings page to the WordPress “Settings” menu in the back-end.

1
2
3
function CMDL_custom_menu_page(){
add_menu_page( "CommandLine", "Command Line", "manage_options", "console-main", "CMDL_GUI", plugins_url()."/CommandLine/etc/icon20.png", 26 );
}

The first of the functions below is an AJAX listener. Using AJAX will allow for a more fluid user experience. The second function is a function that creates an instance of our class and displays the console.

1
2
3
4
5
6
7
8
9
10
11
12
function CMDL_ajax(){
if( isset( $_REQUEST["command"] ) AND !empty( $_REQUEST["command"] ) ){
$CMD = new CMDL;
$CMD->runCommand( stripcslashes($_REQUEST["command"]) );
}
die;
}</code>

function CMDL_GUI(){
$console = new CMDL;
$console::Console();
}

Now for the last few lines of code for our 'CommandLine.php' file. The following are all action listeners. They wait for the do_action of their respective tags to be called and execute a function specified by the second parameter.

1
2
3
4
5
6
7
8
// When the admin menu is being created, run register_custom_menu_page() function //
add_action('admin_menu', 'CMDL_custom_menu_page');
// AJAX listeners //
add_action("wp_ajax_CMDL_command", "CMDL_ajax");
// When the admin page is readying script, enqueue our script as well //
add_action("admin_enqueue_scripts", "CMDL_style");
// When the admin page is first loading, make sure our script is registered //
add_action("admin_init", "CMDL_scripts");

Don't forget to add this to the end of your file: "?>"

Step 3 - Coding the CMDL class

To prevent this post from being boring, I will not just be providing a couple of sentences as a description for a code segment. Instead, I will try to introduce common problems faced by developers and provide some insight on how to deal with them. I will also explain the more complex and intricate lines of code in more detail.

Open your code editor and create a new file. Call the file 'class-console.php' and save it to the 'CommandLine' folder. I will explain each function one at a time. You should add them to your ''class-console.php' file as they are explained.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
class CMDL{
// 0 for no limit //
const QUERY_LIMIT = 0;
// This array will hold all of our actions.//
public static $_ACTIONS = array(
"delete" => "delete",
"remove" => "delete",
"change" => "change",
"switch" => "change",
"activate" => "activate",
"deactivate" => "deactivate",
"trash" => "trash",
);
// This array will hold all of our identifiers //
public static $_IDENTIFIERS = array(
"user" => "user",
"users" => "user",
"person" => "user",
"people" => "user",
"post" => "post",
"posts" => "post",
"article" => "post",
"articles" => "post",
"theme" => "theme",
"themes" => "theme",
"plugin" => "plugin",
"plugins" => "plugin",
"media" => "media",
"image" => "media",
"video" => "media",
"audio" => "media",
);

In the code above we have started our class called CMDL. We then went on to set two arrays, the actions and the identifiers. The actions are the primary instruction, the equivalent of a command in a real command line. The identifiers are there to determine the type of data that the values are.

We also defined a class constant called "QUERY_LIMIT". When equal to 0, this will indicate that actions are to be performed on as many results as discovered by a database query. When set to a value greater than 0, this constant dictates how many results the action will take affect on.

The following code needs to be added to your code editor. I will not go into any great detail as this function simply deletes a directory.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Don't worry about this function (DO COPY THIS) //
public static function deleteDir($dirPath) {
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/'){
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if(is_dir($file)){
self::deleteDir($file);
}else{
unlink($file);
}
}
rmdir($dirPath);
}

This next function is arguably redundant, but I thought it necessary to keep other functions 'clean'. The function simply outputs an error and cancels the script execution, basically the same as running echo followed by exit.

1
2
3
public function throwError( $error ){
wp_die( $error );
}

Ah! Here's is one that'll wake you up. Firstly I will need to explain the syntax of a command line input. The command line input follows this basic syntax and strictly must be done like this:

COMMAND IDENTIFIER "value 1" "value 2"

Command line syntax example
An example of the command line syntax

The only leniency in this syntax is the option of using single quotes (') as opposed to double quotes (") and the fact that commands and identifiers are NOT case-sensitive. As for everything else (including the spaces between values), it is very strict and simply will not work any other way.

This next function inspects a command line input and extracts the values into an array and then returns that array and what's left of the command line input (the command and identifier).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This function gathers and removes values from a command //
public function extract_values( $input ){
$_VALUES = array();
$length = strlen( $input );
$temporary = (string) "";
$g=0;
for($i=0; $i &lt; $length; $i++){
if($input[$i] == '"' AND strpos(substr($input, $i+1), '"') !== false){
array_push($_VALUES, substr($input, $i+1, strpos(substr($input, $i+1), '"')));
$input = substr_replace($input, "", $i, strpos(substr($input, $i+1), '"')+2);
}elseif($input[$i] == "'" AND strpos(substr($input, $i+1), "'") !== false){
array_push($_VALUES, substr($input, $i+1, strpos(substr($input, $i+1), "'")));
$input = substr_replace($input, "", $i, strpos(substr($input, $i+1), "'")+2);
}
}
return array($_VALUES, $input);
}

IMPORTANT: The above code doesn't play nice with the code block. Any instance of "& l t ;" (without spaces) should be changed to "<"

I want to break down a few things in this function:

Consider this line:

1
array_push($_VALUES, substr($input, $i+1, strpos(substr($input, $i+1), '"')));

And assume our command line input was DELETE USER "Fred" The value of $i when the if condition is satisfied is 12. So we can substitute $i:

1
array_push($_VALUES, substr($input, 13, strpos(substr($input, 13), '"')));

We can deduce that substr($input, 13) is equal to Fred" and so the strpos() (string position) of " will be 4. Leaving us with

1
array_push($_VALUES, substr($input, 13, 4));

Which appends the value "Fred" (without quotes) to the $_VALUES array.

On to our next function. This function looks at what is left of the string returned by our "extract_values" function and determines what the action (command) is.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// This function tells us the action that we are performing or throws an error //
public function determineAction( $input ){
$results = $this->extract_values( $input );
$modified = trim($results[1]);
if(strpos($modified, " ") !== false){
$command = substr($modified, 0, strpos($modified, " "));
}else{ $command = $modified;
} if( array_key_exists(strtolower($command), self::$_ACTIONS) ){
$CMD = self::$_ACTIONS[strtolower($command)];
$modified = preg_replace('/\s\s+/', ' ', $modified);
$modified = explode(" ", $modified);
if($modified[1]){
return array($CMD, $modified[1]);
}else{
$this->throwError( "No identifier was found." );
}
}else{
$this->throwError( "The command '".$command."' is undefined." );
}
}

In this function I feel I need to explain the role of "$this". The $this variable is a reserved variable and refers to the class of which it is existent within, in this case the class CMDL.

I also will explain the line:

1
$modified = preg_replace('/\s\s+/', ' ', $modified);

What this line does is uses regular expression (REGEX) to remove occurrences of two or more spaces.

Just in case you don't know what you're doing right now, you should be adding these functions to your "class-console.php" file as we go through them.

Important: Like before... These code block are not doing their job well. the REGEX will look to you like "/ss+/" what it should be is "/\s\s+/"

The next function is one that is used to determine the identifier specified. There really isn't all too much to this function ergo I'm providing minute information.

1
2
3
4
5
6
7
8
9
10
public function determineIdentifier( $input ){
$results = $this->determineAction( $input );
$modified = trim($results[1]);
if( array_key_exists(strtolower($modified), self::$_IDENTIFIERS) ){
$ID = self::$_IDENTIFIERS[strtolower($modified)];
return array($ID, $results[0]);
}else{
$this->throwError( "The identifier '".$modified."' is undefined." );
}
}

This next function is essentially the interface that the front end uses to communicate with our functions.

1
2
3
4
5
6
7
8
9
10
11
12
public function runCommand( $input ){
$result = $this->determineIdentifier( $input );
$ID = $result[0];
$CMD = $result[1];
$Values = $this->extract_values( $input );
$Values = $Values[0];
if( method_exists( $this, $CMD ) ){
$this->$CMD( $ID, $Values );
}else{
$this->throwError( "The command '".$CMD."' is undefined." );
}
}

If for whatever reason you couldn't work out what this functions does, quite simply, it runs a command.

I want to signal out the line:

1
$this->$CMD( $ID, $Values );

This line of code runs a function of $CMD passing the arguments $ID (our identifier) and $Values (our values from extract_values). So if we again consider our example from earlier (DELETE USER "FRED"), this eventuates to this line executing as: delete( "user", array("Fred") ).

Now the code gets messy. We are now moving into creating our actual commands functionality. I've provided the functionality:

  • Delete (users, posts, themes & media)
  • Trash (posts)
  • Change (Theme)
  • Deactivate (plugins)
  • Activate (plugins)

When I explain each of the command functions, the structure will become apparent. By this I mean if you wanted to create your own command, you would just need to create a function as the name of your command and except the arguments $ID (identifier) and $Values.

We'll start with the delete command, which works with all of our defined identifiers except plugins.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
public function delete( $ID, $Values ){
global $wpdb;
switch( $ID ){
case "user":
foreach($Values as $value){
$user = get_user_by('login', $value);
if($user){
wp_delete_user( $user->ID );
}else{
$this->throwError( "No such user: ".$value );
break;
}
}
break;
case "post":
foreach($Values as $value){
$limit = (self::QUERY_LIMIT) ? "LIMIT 0, ".self::QUERY_LIMIT : "" ;
$myrows = $wpdb->get_results( "SELECT id FROM $wpdb->posts WHERE post_title = '$value' AND post_type = 'post' ".$limit );
foreach($myrows as $row){
wp_delete_post( $row->id, true );
}
}
break;
case "theme":
$themeDir = realpath(get_theme_root( $value )) . "/";
foreach($Values as $value){
$value = strtolower($value);
if( is_dir( $themeDir . $value ) ){
$subjectDir = $themeDir . $value;
}elseif( is_dir( $themeDir . str_replace(" ", "", $value) ) ){
$subjectDir = $themeDir . str_replace(" ", "", $value);
}elseif( is_dir( $themeDir . str_replace(" ", "-", $value) ) ){
$subjectDir = $themeDir . str_replace(" ", "-", $value);
}if( !$subjectDir ){
$this->throwError( "The theme '".$value."' does not exist." );
}else{
self::deleteDir( $subjectDir );
}
}
break;
case "plugin":
$this->throwError( "Delete command does not support identifier: plugin" );
break;
case "media":
foreach($Values as $value){
$limit = (self::QUERY_LIMIT) ? "LIMIT 0, ".self::QUERY_LIMIT : "" ;
$myrows = $wpdb->get_results( "SELECT id FROM $wpdb->posts WHERE post_title = '$value' AND post_type = 'attachment' ".$limit );
foreach($myrows as $row){
wp_delete_post( $row->id, true );
}
}
break;
}
}

The foreach loop at the start of the function loops through every supplied value. We're using a switch control structure to execute code dependent on the identifier supplied.

Now lets look at the trash function. As previously mentioned, this function only works on posts. It's pretty obvious from the name that this function trashes posts.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public function trash( $ID, $Values ){
global $wpdb;
if( $ID == "post" ){
foreach($Values as $value){
$limit = (self::QUERY_LIMIT) ? "LIMIT 0, ".self::QUERY_LIMIT : "" ;
$myrows = $wpdb->get_results( "SELECT id FROM $wpdb->posts WHERE post_title = '$value' AND post_type = 'post' ".$limit );
foreach($myrows as $row){
wp_trash_post( $row->id, true );
}
}
}else{
$this->throwError( "Trash command does not support identifier: ".$ID );
}
}

Moving on... we'll now look at the change function. Not as blatantly revealing as the other function names, this function changes your current theme. Earlier I mentioned that I would be introducing some issues of coding in WordPress, here is a good example: If the name of the theme folder happens to have capital letters in the name then this will return a message saying that the theme was not found (As is the case when deleting themes).

If you really wanted to you could add some additional if statements to the function to ensure it finds any theme you could ever possibly find. I installed a bunch of themes from a blank search in WordPress and successfully ran the change command on all of them.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public function change( $ID, $Values ){
if( $ID == "theme" ){
foreach($Values as $value){
$value = trim($value);
if(wp_get_theme( $value )->exists()){
update_option("template", $value);
update_option("stylesheet", $value);
do_action("switch_theme");
}elseif(wp_get_theme( strtolower($value) )->exists()){
update_option("template", strtolower($value));
update_option("stylesheet", strtolower($value));
do_action("switch_theme");
}elseif(wp_get_theme( strtolower(str_replace(" ", "", $value)) )->exists()){
update_option("template", strtolower(str_replace(" ", "", $value)));
update_option("stylesheet", strtolower(str_replace(" ", "", $value)));
do_action("switch_theme");
}elseif(wp_get_theme( strtolower(str_replace(" ", "-", $value)) )->exists()){
update_option("template", strtolower(str_replace(" ", "-", $value)));
update_option("stylesheet", strtolower(str_replace(" ", "-", $value)));
do_action("switch_theme");
}else{
$this->throwError( "The theme ".$value." was not found.");
}
}
}else{
$this->throwError( "Change command does not support identifier: ".$ID );
}
}

Now we get into the first of two ridiculously long functions. The deactivate function deactivates the plugins specified. This was by far the hardest of the lot to code. The plugin loops through all of the values. For every value, the function:

  • Gathers an array of the entire contents of the /wp-content/plugins/ directory
  • Determines whether each array item is a directory or file (because plugins can be in either form)
  • If it's a file, it checks each line until it finds the plugin header information
  • If it's a directory, it checks every line within every file within the directory until it finds the plugin header information
  • Extracts the name of the plugin
  • Finally deactivates the plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public function deactivate( $ID, $Values){
if( $ID == "plugin" ){
foreach($Values as $value){
$path = ABSPATH . "wp-content/plugins/";
if( is_dir( $path ) ){
$plugins = scandir($path);
foreach($plugins as $plugin){
if($plugin != "." AND $plugin != ".." AND $plugin != "index.php"){
if( is_file( $path . $plugin ) ){
$handle = file( $path . $plugin );
foreach($handle as $line){
if( stripos( $line, "plugin name" ) !== false){
$final = trim(substr(strstr($line, ":"), 1));
break;
}else{
continue;
}
}
if( $final == $value ){
$file = $path . $plugin; deactivate_plugins( $file );
break;
}
}elseif( is_dir( $path . $plugin ) ){
$within = scandir($path.$plugin);
foreach($within as $file){ if($plugin != "." AND $plugin != ".."){
if( is_file( $path . $plugin . "/" . $file ) ){
$handle = file( $path . $plugin . "/" . $file );
foreach($handle as $line){
if( stripos( $line, "plugin name" ) !== false){
$final = trim(substr(strstr($line, ":"), 1));
break;
}else{
continue;
}
}
if( $final == $value ){
$fileX = $path . $plugin . "/" . $file;
deactivate_plugins( $fileX );
break;
}
}
}
}
}
}
}
}
}
}else{
$this->throwError( "Deactivate command does not support identifier: ".$ID );
}
}

The final command function is the activate function. As you probably guessed this function activates the plugins specified. This function is nearly identical to the deactivate function, although performing an antonymous function - ironic, I know. Anyway here's the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
public function activate( $ID, $Values){
if( $ID == "plugin" ){
foreach($Values as $value){
$path = ABSPATH . "wp-content/plugins/";
if( is_dir( $path ) ){
$plugins = scandir($path);
foreach($plugins as $plugin){
if($plugin != "." AND $plugin != ".." AND $plugin != "index.php"){
if( is_file( $path . $plugin ) ){
$handle = file( $path . $plugin );
foreach($handle as $line){
if( stripos( $line, "plugin name" ) !== false){
$final = trim(substr(strstr($line, ":"), 1));
break;
}else{
continue;
}
}
if( $final == $value ){
$file = $path . $plugin; activate_plugin( $file );
break;
}
}elseif( is_dir( $path . $plugin ) ){
$within = scandir($path.$plugin);
foreach($within as $file){
if($plugin != "." AND $plugin != ".."){
if( is_file( $path . $plugin . "/" . $file ) ){
$handle = file( $path . $plugin . "/" . $file );
foreach($handle as $line){
if( stripos( $line, "plugin name" ) !== false){
$final = trim(substr(strstr($line, ":"), 1));
break;
}else{
continue;
}
}
if( $final == $value ){
$fileX = $path . $plugin . "/" . $file;
activate_plugin( $fileX );
break;
}
}
}
}
}
}
}
}
}
}else{
$this->throwError( "Activate command does not support identifier: ".$ID );
}
}

This should be the last piece of code you'll have to copy. It is the code that actually displays a command console on our plugin page.

1
2
3
4
5
6
public static function Console( $Width=null, $Height=null ){
$width = ($Width) ? "width: ".$Width." !important;" : "";
$height = ($Height) ? "height: ".$Height." !important;" : "";
$Cstyle = ($width.$height) ? 'style="'.$width.$height.'overflow:auto;"' : '';
echo '<div class="wrap"><div id="CMDL-32" class="icon32"><br /></div><h2>Command Line</h2><br/><div '.$Cstyle.' class="CMDL-console"><div id="CMDL-inner-console">Your WordPress Console<span id="CMDL-status"></span></div><input spellcheck="false" autocomplete="off" id="CMDL-console-input" type="text" style="width:100%;outline: #000 !important;color:#ffffff;background-color: #000 !important;border: 0px solid #000;font-size: 16px;font-family:Lucida Console;"/></div></div>';
}

NOTE: If you've been paying attention as you've been copying the code, you'd have noticed that there is a class that needs closing, so ensure that you paste "}" right now to just after you pasted the last function. This will end the class. Also remember to close the PHP code with a "? >". So just in case you're passively skimming through copying and pasting;

Copy And Paste:

} ?>

Step 4 - customization

As I have mentioned this plugin is extensible. I also mentioned that you didn't need to know how to code to follow this tutorial and I'm going to honor that claim. I'm now going to take you through the process of adding more functionality to your command line.

Since we have to assume you do not have any coding knowledge, you will be bound by what the WordPress Codexhas to offer.

Things to consider:

    • The codex may not always have the appropriate resources you're looking for
    • If you're adding the following example, it must be placed in the file "class-console.php"
    • copying and pasting code to the end of your document will result in an error. If you do choose to add the next example to your code it must be inside the CMDL class.

We are going to add another command called "UPDATE", this could be extended to change a variety of WordPress settings, but we're just going to have it change the WordPress tagline just as a proof of concept.

Scroll through your code until you find where your last function, "activate", ends.

On a new line add the following code:

1
2
3
4
5
6
7
8
9
public function update( $ID, $Values ){
if( $ID == "tagline" ){
foreach($Values as $value){
// Our next code will be pasted here //
}
}else{
$this->throwError( "Update command does not support identifier: ".$ID );
}
}

This adds an update function, allowing the identifier "tagline". Which leads us to adding the identifier "tagline".

In your code editor find where we added the "$_IDENTIFIERS" code. That code should end like this:

1
2
"audio" => "media",
);

After the apostrophe ',' and on the next line down, add this line:

1
"tagline" => "tagline",

Ensure the ");" still ends the array.

We are now going to do something very similar to actually add the command.

In your code editor find where we added the "$_ACTIONS" code. That code should end like this:

1
2
"trash" => "trash",
);

After the apostrophe ',' and on the next line down, add this line:

1
"update" => "update",

Ensure the ");" still ends the array.

Find and delete the line "// Our next code will be pasted here //" in the function we just added. In its place we are going to put the code that actually updates the tagline.

Add this code:

1
update_option( "blogdescription", $value );

And you're done! Now we can change the tagline of our WordPress site by running the command:

UPDATE TAGLINE "My New Tagline"

Step 5 - Check and install

Now that you have copied all of the code, you should save you files and make sure you have:

      • A folder called "CommandLine" <ul >
      • Consisting of:
      • CommandLine.php
      • class-console.php
      • A folder called "etc" <ul >
      • Consisting of:
      • main.js
      • style.css
      • icon.png
      • icon20.png

If you have all of the files then you should compress the CommandLine folder to a .zip file.

Highlighted buttons & boxes leading to the upload form

After you have the zipped folder, open WordPress and upload the zip file from the "Plugins" menu. You should then activate the plugin. You should now see the menu "Command Line".

Using the Command Line Plugin

Command Line in WP menu

Listed below are the syntax of the commands we added during this tutorial.

DELETE USERS | POSTS | THEMES | MEDIA "Value A" "Value B" "Value C"...

TRASH POSTS "Post Title A" "Post Title B" "Post Title C"...

CHANGE THEME "Theme Name"

DEACTIVATE PLUGINS "Plugin Name A" "Plugin Name B" "Plugin Name C"...

ACTIVATE PLUGINS "Plugin Name A" "Plugin Name B" "Plugin Name C"...

UPDATE TAGLINE "My new tagline"

NOTE: The spaces between the quotes of the values are not optional. When passing more than one value the spaces between the quoted values are needed.

Command Line errors
Command Line errors

When using the command line you can press the up arrow on your keyboard to return the command you last ran since you loaded the page. Entering the command "clear" (without quotes), will reset the command line. Another thing to note is the lime colored box in the top-right corner of the command line. This box will become amber when a command is running and return to lime when there are no commands executing. Any errors occurred during execution will be returned to the command line in red.

And That's It

To wrap up this tutorial I will leave you with the links to the codex pages of the WordPress core functions we used and the php.net pages.

If you are having difficulties with getting the plugin to work, leave a comment and I'll help you out.

Useful links

WordPress

php.net

Related posts:

  1. 11 Ways to Make Your WordPress Site Faster and Leaner Is your site slow? Does it it crawl at a...
  2. Manually Insert a Line Break in WordPress How to add spaces in your posts when WordPress keeps...
  3. Make Regular Custom Backups of Your WordPress Site for FREE with the XCloner Plugin Not willing to shell out a hundred dollars for a...
]]>
http://wpmu.org/wordpress-command-line/feed/ 3
Swiftype: The Best Search Solution For WordPress http://wpmu.org/wordpress-search-plugin/ http://wpmu.org/wordpress-search-plugin/#comments Tue, 23 Apr 2013 14:30:40 +0000 Sarah Gooding http://wpmu.org/?p=112464 Despite WordPress’ world class publishing capabilities, the native search function leaves something to be desired. In fact, on larger sites it can be damn near impossible to find what you’re looking for. We set out to find the best possible search solution for WordPress and have been completely blown away by Swiftype.

This revolutionary app allows you to tailor your site’s search results to help users find the most relevant content. The app works alongside WordPress via a plugin and gives you the ability to fine tune search queries. Essentially you’ll be creating your own search engine that is more efficient and user-friendly than the WordPress default.

How is Swiftype better than the default WordPress search?

Swiftype search in action on WPMU.org
Short answer? The Swiftype Search plugin for WordPress is in every way better than the default search. Swiftype’s base ranking algorithm is based on industry best-practices and provides more relevant results than the WordPress default. The app goes beyond the basics by providing detailed search analytics and a simple, drag-and-drop interface for re-ordering your search results.

Swiftype Features:

  • Easy to set up – the Swiftype crawler creates your search engine in minutes, no coding required
  • VIP-approved plugin – The plugin has passed the VIP standards for quality and performance
  • Detailed Analytics – Built-in real-time search analytics
  • Custom Result Ranking – Drag-and-drop your search results to re-order them and changes will be instantly reflected on your website.
  • Excellent Mobile Support – Search works great in mobile browsers and Swiftype’s native iOS and Android SDKs make it easy to integrate with apps
  • Advanced Developer API – Get more of your search engine with the Developer API
  • Search Across Multiple Domains – Show results from any of your linked sites

What we love about Swiftype:

We’ve been using Swiftype to power our search capabilities for several months on Edublogs and WPMU.org and couldn’t be more pleased. From our experience with Swiftype on Edublogs we’re finding a decrease in support requests. Users are letting us know it’s easier for them to find the information they’re looking for.

There are two features that are making the biggest impact on Edublogs support:

  • 1. Auto suggest of posts based on search terms – nearly half of all searches are “auto selects”. This tells us that users are finding their answers faster than before.
  • 2. Being able to manually adjust search results to prioritize our most common searches.
Swiftype analytics

We also love the stats Swiftype provides in the search engine dashboard. For example, one section is dedicated to showing you “Top Searches With No Results”. Those are search terms that you’ll want to pay attention to and get to work creating better results. It also shows you the top searches on your site so you can get a better idea of what people are looking for when they come to you.

How can your site benefit from Swiftype search?

Reorder search results based on your business priorities
If your site has resources scattered across many posts and pages then the Swiftype search will give you the opportunity to quickly organize results based on topic and relevance.

WordPress sites with products for sale can also benefit from its detailed analytics. Knowing what visitors are searching for on your site can help you to know what products to add to your inventory. It can also help you to tailor your UI and marketing to focus on your most-searched for products and increase sales.

Exclusive WPMU Discount: 75% Off the first month

Swiftype is trusted to handle search functionality for many well-known online businesses, including Shopify, SendGrid, MailChimp, KISSmetrics, Mixergy and many more. A basic account is free and offers all of the same powerful search features. This is perfect for smaller sites and you won’t be obliged to upgrade.

Upgraded accounts enjoy use on multiple domains, unlimited query customizations, more frequent recrawls, dedicated support and more. Take advantage of all of these awesome features and search power with our exclusive 75% off discount for WPMU.org readers. Sign up for a free account today, install the Swiftype Search WordPress plugin and take it for a test drive. We’re big fans of Swiftype and we know that you won’t be disappointed.

Related posts:

  1. WPMU DEV SEO is Your One-Stop Solution to Optimize Your WordPress Site for Search Engines Tired of installing numerous plugins to try to manage bits...
  2. The Custom Google Search Plugin Enhances Your WordPress Search Results We love WordPress but there's always room for improvements -...
  3. How to Show Password-Protected Posts in WordPress Search Results Did you know that WordPress doesn't show password-protected posts in...
]]>
http://wpmu.org/wordpress-search-plugin/feed/ 10
Replace BuddyPress Friends Functionality With Followers http://wpmu.org/replace-buddypress-friends-functionality-with-followers/ http://wpmu.org/replace-buddypress-friends-functionality-with-followers/#comments Thu, 18 Apr 2013 08:15:40 +0000 Sarah Gooding http://wpmu.org/?p=113426 Every BuddyPress site has different requirements for how users should be able to connect. The built-in friendship functionality of BuddyPress is not appropriate for every social network. This is especially true for professional networks. In many instances you may want to replace the friendship component with followers instead. Luckily, there’s a plugin that does that for you.

The BuddyPress Follow plugin is what you’re looking for. It allows members to follow other members activity and has just been updated to be compatible with BuddyPress 1.7. The plugin adds a new activity stream tab, follow/unfollow buttons to member profiles and a new tab to display the users following/followers in the members page along with total counts.

What are the differences between Friends and Followers?

Follow button replaces the Add Friend button
Friending and following are very similar but have one main difference. Following does not have to be reciprocated, whereas friendship must be approved by both parties. Following works just the same way the Follow button works on Twitter.

Please note that it is not recommended to have the native friends component turned on when using the followers plugin. This would probably cause confusion to users who may not know the difference. If you want to change your BuddyPress site to use followers instead of friends, install the BuddyPress Follow plugin, available for free in plugin repository.

Related posts:

  1. BuddyPress Followers Plugin: A Different Way For Users to Make Friends The new BuddyPress Followers plugin is now available. It has...
  2. BuddyPress Private Messages for Followers Only Now Available Cut down on annoying private messaging spam with this new...
  3. Assign Automatic Friends to New Users on Your BuddyPress Site Nobody likes to sign up to a new social network...
]]>
http://wpmu.org/replace-buddypress-friends-functionality-with-followers/feed/ 5
Posterous Shutting Down: How To Move Your Posterous Site To WordPress http://wpmu.org/posterous-shutting-down-how-to-move-your-posterous-site-to-wordpress/ http://wpmu.org/posterous-shutting-down-how-to-move-your-posterous-site-to-wordpress/#comments Thu, 11 Apr 2013 17:15:31 +0000 Sarah Gooding http://wpmu.org/?p=112929
Posterous is shutting April 30, 2013.
The popular Posterous blogging service is shutting down on April 30, 2013. Now is the time to move your Posterous site to WordPress. Don’t worry, this process doesn’t have to be a pain in the ass. In fact, we’ve created a plugin that makes it very simple, no matter how large your Posterous import may be.

Our Posterous Importer Advanced plugin is a free migration tool for Posterous blogs. This is the best and most advanced Posterous importer available. Not only does it import posts, comments, tags, and attachments, it also grabs embeds and audio so you don’t lose any of your media.

How To Get Your Posterous Site Backup File

You don’t have to have be technically inclined in order to move your site to WordPress. Just follow these simple instructions outlined by Posterous to get your WXR backup file:

  • Step 1: Go to http://posterous.com/#backup.
  • Step 2: Click to request a backup of your Space by clicking “Request Backup” next to your Space name.
  • Step 3. When your backup is ready, you’ll receive an email.
  • Step 4: Return to http://posterous.com/#backup to download a .zip file.

How To Migrate Your Site From Posterous To WordPress

Moving your content into WordPress can be done in two easy steps.

Step 1: Add the Posterous Importer Advanced Plugin to WordPress

First, install the Posterous Importer Advanced plugin. This will only work with self-hosted WordPress installations. Most hosting companies have a quick install that you can use to get WordPress up and running with one click.

After you have a basic install up and running, go to Dashboard >> Plugins >> Add New and install the Posterous Importer Advanced plugin.

Step 2: Import Your Posterous Content Into WordPress

After the plugin is activated, you’ll find the importer at Tools >> Import.

Dashboard >> Tools >> Import

Click on Posterous. Now you can upload the WXR (.xml) file you got when you backed up your Posterous site.

Import Posterous WXR file

Now, relax while all your content is automatically imported. Congratulations, you’ve successfully migrated your Posterous site and entered the world of WordPress!

Important Notice: After April 30th, Posterous is shutting down its API and this plugin will no longer work.

Posterous Importer Advanced has been added to our growing list of free plugins in the WordPress plugin repository. We’ve tested this plugin extensively with our Edublogs network and have made a number of changes to make sure it is optimized to scale to very large imports. Get your site migrated before it’s too late!

Related posts:

  1. How to Migrate from Posterous to WordPress Need to move your blog from Posterous to WordPress? We're...
  2. I’m Going To Miss Posterous A few days ago Twitter acquired Posterous in a move...
  3. How to Move Your WordPress Store From WP E-Commerce to MarketPress Did you know that the MarketPress plugin has a product...
]]>
http://wpmu.org/posterous-shutting-down-how-to-move-your-posterous-site-to-wordpress/feed/ 0
5 Caching Plugins to Speed Up Your WordPress Site http://wpmu.org/speed-up-wordpress-caching-plugins/ http://wpmu.org/speed-up-wordpress-caching-plugins/#comments Thu, 11 Apr 2013 15:30:32 +0000 Sufyan bin Uzayr http://wpmu.org/?p=112354 Let’s face it: when it comes to browsing the internet, people have little patience. If your website is slow, you will not leave a good impression on your visitors, no matter how great your content is! A website that loads without unnecessary delays gets good marks both in terms of user experience as well as search engine rankings.

And, it is common knowledge that caching can help you speed up your website’s load times. So, which is the best caching plugin for WordPress? Yes, we shall attempt to answer this question in this article by taking a look at five of the top caching plugins.

Five Leading Solutions

1. WP Super Cache

WP Super Cache relies on a simple logic: it generates static HTML files based on the content of your blog, and each time that particular section of your blog is accessed, the static HTML file is served instead of actually calling numerous PHP scripts over and over again.

Content can either be served using Mod_rewrite which completely bypasses PHP or using PHP itself. A third option, legacy caching, is available for logged in users or users who are leaving comments.

WP Super Cache Settings Page

The interface of WP Super Cache surely has a steep learning curve to it, and it can be confusing for a beginner. Basically, the plugin puts the power in your hands: you are responsible for almost every aspect of its functioning. However, it does come with a good set of documentation and manuals, so you will not end up feeling clueless.

To begin with, you can specify the cache expiry time, as well as select the pages which shall be cached.

One of the most impressive parts about the plugin is that it works well with CDN Sync Tool. In fact, there is a separate page in the settings panel to help you configure your CDN settings, as shown below:

CDN Settings in WP Super Cache

CDN tool is essential if you want to speed up your website. Naturally, it is an added bonus if your cache plugin acknowledges the importance of CDN and can work alongside it.

Verdict

WP Super Cache is a very popular plugin, and is used by millions of WP users. If you are looking for a handy plugin that can help you speed up your website, and also satisfy the control-freak in you, WP Super Cache should be your first pick. On the other hand, if too many tweaks and configurations scare you (to be honest, there are many people who prefer a caching plugin that does not ask them multiple questions), WP Super Cache may not be the right choice.

  • Total Downloads (as of 29th March, 2013): 4,210,157
  • Last Updated: December, 2012

2. Hyper Cache Extended

Hyper Cache Extended is based on the original Hyper Cache plugin. The plugin maintains both plain and gzip compressed pages, and is an ideal pick for those with shared hosting plans having limited bandwidth. Hyper Cache Extended can redirect caching, perform 404 caching, and comes with compatibility settings for Global Translator.

Hyper Cache Extended Settings Panel

Unlike WP Super Cache, Hyper Cache Extended has fewer settings for you to tweak and configure. The settings page does not have multiple tabs (though it is divided into sub-segments). You can specify separate settings for mobile devices, as well as selectively turn off cache settings (for example, disallow caching on the homepage). Hyper Cache Extended inherits most of the functionality of its parent plugin, and you can check out the details about the latter here.

Mobile Settings in Hyper Cache Extended

Verdict

Hyper Cache Extended is a great pick if you need a simple plugin that helps you get the job done efficiently. As mentioned above, it is meant for those who are on shared hosting accounts with limited resources. For power users and advanced websites, WP Super Cache will offer more flexibility and prowess than Hyper Cache Extended.

Also, Hyper Cache Extended has not yet been tested for multisite configuration. Very clearly, this is not your ultimate solution for caching needs. Instead, it is more of a plugin that you can use if your blog is hosted on a cheap and less powerful server.

  • Total Downloads: 28,800
  • Last Updated: January, 2013

3. Quick Cache

The third plugin on our list, Quick Cache, relies on an intuitive caching mechanism to bring down the processing time of your pages. By default, Quick Cache does not show cached pages to logged in users or those who have left a comment. Plus, admin pages, login pages and other pages that you may specify are excluded as well. The plugin also has support for Sitemap auto caching.

Quick Cache has a simple Settings Page

Quick Cache has a good-looking interface and the options page is rather simple to configure. Unlike WP Super Cache and Hyper Cache Extended, Quick Cache does not present you with a lot of settings — instead, the configuration is basically a matter of yes/no questions:

  • Cache pages for logged in users? Yes/No
  • Allow double caching? Yes/No
  • Enable dynamic caching? Yes/No
  • And so on…

Verdict

Quick Cache does not aim to be a Swiss Army knife of the caching world. Instead, it intends to make the caching process simple, and it succeeds in its goal. You should consider using it if other plugins are proving to be too complicated and their settings pages appear nothing more than jargon to you. For all other advanced purposes, you will find Quick Cache to be too limited in operation.

  • Total Downloads: 406,143
  • Last Updated: December, 2011

4. DB Cache Reloaded Fix

DB Cache Reloaded Fix is based on the DB Cache Reloaded plugin (the patch adds support for WordPress 3.4 and beyond), which in turn is a fork of the DB Cache plugin. The plugin author claims to have made the new plugin “more secure,” though no actual security details are given. Still, given the fact that DB Cache Reloaded Fix is actually compatible with, and has been tested on, the latest versions of WordPress, it does rank higher than its parent and grandparent on the security scale.

DB Cache Reloaded Fix Settings Page

Unlike other HTML caching plugins, DB Cache Reloaded Fix relies on database caching. DB Cache Reloaded Fix ensures that your visitors always see the latest version of the given page. It also helps reduce server load.

DB Cache Reloaded Fix is one of the simplest caching plugins in terms of operation and customizability. The only things that you can specify using the settings panel include enabling/disabling of caching, time limit for expired cache queries, and some additional cache filters.

Verdict

DB Cache Reloaded Fix relies on database caching, and the improvements in page load times are noticeable. However,  I think the others on this list are better plugins. While DB Cache Reloaded Fix is a good plugin in its own right, for all advanced purposes, WP Super Cache (or W3 Total Cache, which we shall discuss below) should gain primary consideration. If you need a simple plugin, Quick Cache can suffice too. As a side-note, DB Cache Reloaded Fix has not been updated since WP 3.4 (reviews do claim that it works with version 3.5, by the way).

  • Total Downloads: 109,210
  • Last Updated: June, 2012

5. W3 Total Cache

With over 1,861,000 downloads, W3 Total Cache is an extremely popular plugin. It comes with progressive caching to load pages quickly. The plugin claims to save as much as 80% of your bandwidth by using minify and HTTP compression of HTML, CSS, JavaScript, etc.

Instead of disk caching, W3TC relies on memory caching, which can give you better results. However, it also means that the plugin requires a good deal of resources to work with, so if you are on a shared platform with limited resources, W3 Total Cache is probably not meant to serve you.

W3 Total Cache can work along side your Content Delivery Network to enhance your website’s overall performance. The plugin is compatible with BuddyPress as well. To learn more about its features, check this out.

Verdict

Memory caching is not something you can expect every host to provide: if you are on a shared hosting package or have limited resources at your disposal, don’t bother considering W3 Total Cache. In fact, on certain “free” web hosts, if you attempt to install and run W3 Total Cache, your account might be suspended for using excess resources. Of course, you will not use a free host for your website, but this can give you a fair idea about the plugin’s requirements.

That said, if your server resources allow you to do so, go ahead and check out the plugin, because it can really do wonders for your website and is one of the most recommended caching plugins out there!

  • Total Downloads: 1,861,822
  • Last Updated: February, 2013

Also Worth A Look…

  1. MO Cache: Used for caching translation files on a localized WP installation (in a localized installation, translation files can account for as much as 70% of load times).
  2. WP Widget Cache: Can help in caching the widgets on your blog and reduce the number of queries to your database.
  3. Lite Cache: One of the smallest caching plugins with gzip compression.

Conclusion

So, which of the above five plugins should you use?

Well, the answer depends on your needs, and WPMU has already attempted to answer this question here. However, I shall try to simplify the answer below:

Simplicity+Ease of use = Quick Cache

Customizability+Popularity = WP Super Cache

Loads of Resources+Customizability = W3 Total Cache

If you need more than that, you can check out some mind-numbing numbers benchmarks here. Plus, FolioVision has a decent article about their experiences with various caching plugins.

Which caching plugin do you use? Have your say in the comments below!

*Featured Image: lokiv7

Related posts:

  1. The Best Caching Plugins for WordPress – Recommended By Our Readers Straight from the horse's mouth, this is what our readers...
  2. Apparently ‘Super Cache’ Is The Most Popular WordPress Caching Plugin But does more users necessarily mean better quality? ...
  3. New CDN Sync Tool Works with WordPress Caching Plugins to Optimize Performance Page load time is becoming increasingly important, not only for...
]]>
http://wpmu.org/speed-up-wordpress-caching-plugins/feed/ 19