WordPress and BuddyPress Customer Reviews Plugin

This tutorial can be skipped by using the new WordPress Review Plugin

Best WordPress Customer Reviews PluginThe search for the most effective customer reviews plugin for WordPress and BuddyPress is still ongoing. There are countless WP reviews plugins out there, each with their own features and flaws. One would think that by putting the best review plugins together into one plugin would disregard the need for a new plugin or upgrade. So why not start with a plugin that is as close as possible to what you are looking for and add the scripts to extend it with the features you need? The following post will provide with the plugin and setup we will use to create the perfect reviews system on your WordPress or BuddyPress install.

The features that most WordPress developers seek for their review site are quite similar, and those are:

A recent project of ours involved developing a local business reviews site, like Yelp and CitySearch. To make it compatible with user submitted businesses or products, we developed all the above features to be compatible with most developments via Custom Fields, an already integrated WP feature. The ability to for users to post businesses or products themselves that are to be reviewed, is another topic to be covered on upcoming posts.

Extending WP Customer Reviews Plugin

After going over which WordPress plugins for reviews would be good to build from, I found that WP Customer Reviews, a newer plugin was the developer friendliest. The plugin itself is great, already has SEO rich snippets for businesses, products and reviews, allows admin moderation and site-wide integration. Sadly, it lacks the most requested features, which can be relatively easy to integrate in the plugin via the code.

The reason for this is typically the integration for a user-friendly way to control this in the WordPress admin section, which can be difficult to apply to all types of site templates, custom fields or other possible conflicts. Yet, WP Customer Reviews is a great plugin and one of the best of its kind.

We used WP Customer Reviews version 2.4.5 for the tutorials, which you can download on their WordPress Plugins Page.

Review Rich Snippets

Upon install of the plugin you will already have a basic Star Rating feature with Search Engine Optimized Reviews with Rich Snippets.

WPCR Plugin Setup

Before we start adding the new features to WPCR, we will disconnect the front-ends script from the admin settings, which will give you more control over your scripts functionality as well as understanding. This begins our first tutorial, and although this will be essential for some of the next feature implementations, you may implement them independently of each other (hence the code lines may differ in your script).

Open /wp-content/plugins/wp-customer-reviews/wp-customer-reviews.php and find the following lines:

function get_options() {
        $home_domain = @parse_url(get_home_url());
        $home_domain = $home_domain['scheme'] . "://" . $home_domain['host'] . '/';

        $default_options = array(
            'act_email' => '',
            'act_uniq' => '',
            'activate' => 0,
            'ask_custom' => array(),
            'ask_fields' => array('fname' => 1, 'femail' => 1, 'fwebsite' => 1, 'ftitle' => 1, 'fage' => 0, 'fgender' => 0),
            'business_city' => '',
            'business_country' => 'USA',
            'business_email' => get_bloginfo('admin_email'),
            'business_name' => get_bloginfo('name'),
            'business_phone' => '',
            'business_state' => '',
            'business_street' => '',
            'business_url' => $home_domain,
            'business_zip' => '',
            'dbversion' => 0,
            'enable_posts_default' => 0,
            'enable_pages_default' => 0,
            'field_custom' => array(),
            'form_location' => 0,
            'goto_leave_text' => 'Click here to submit your review.',
            'goto_show_button' => 1,
            'hreview_type' => 'business',
            'leave_text' => 'Submit your review',
            'require_custom' => array(),
            'require_fields' => array('fname' => 1, 'femail' => 1, 'fwebsite' => 0, 'ftitle' => 0, 'fage' => 0, 'fgender' => 0),
            'reviews_per_page' => 10,
            'show_custom' => array(),
            'show_fields' => array('fname' => 1, 'femail' => 0, 'fwebsite' => 0, 'ftitle' => 1, 'fage' => 0, 'fgender' => 0),
            'show_hcard' => 1,
            'show_hcard_on' => 1,
            'submit_button_text' => 'Submit your review',
            'support_us' => 1,
            'title_tag' => 'h2'
        );

You will notice that the above section corresponds to the admin sections settings - it's described well so you can probably guess what each variable is for. In order to use the above settings, you'd need to deactivate the following line:

);
        
        //$this->options = get_option('wpcr_options', $default_options);

        /* magically easy migrations to newer versions */
        $has_new = false;
        foreach ($default_options as $col => $def_val) {

By commenting out the above, you avoid that the admin inputs overwrite what you manually place in the array. Although you can place your default content within those fields now, such as 'business_city' => 'New York', 'business_country' => 'USA', 'business_email' => 'any@email.com',..., some of the variables may still get overwritten within the file.

The next post will cover how we use the above setup to integrate different business locations and notification emails per post, instead of the default one business and notification e-mail.

I'm a developer at Maximus Business.

    Leave a Reply

    Please feel free to give us your feedback and comment below. Please keep in mind that comments are moderated. Your email address will not be published. Required fields are marked *


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>