Archive for the ‘Plugins’ Category

Give Editors access to Redirection

Redirection is a powerful tool allowing you to manage redirects for your WordPress site.  For a recent project we needed to allow users with a role of Editor to add and manage redirects, so we had to do a little plugin tweaking to get that access granted.  Here is what you need to do.

On line 121 of this file:
/wp-content/plugins/redirection/redirection.php

Replace this:

function admin_menu() {
  	add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "delete_others_pages", basename( __FILE__ ), array( &$this, "admin_screen" ) );
	}

With this:

function admin_menu() {
  	add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "manage_options", basename( __FILE__ ), array( &$this, "admin_screen" ) );
	}

On line 36 of this file:
/wp-content/plugins/redirection/ajax.php

Replace this:

function init() {
		if ( current_user_can( 'administrator' ) ) {
			$this->post = stripslashes_deep( $_POST );

			$this->register_ajax( 'red_log_show' );
			$this->register_ajax( 'red_log_hide' );
			$this->register_ajax( 'red_log_delete' );

With this:

function init() {
		if ( current_user_can( 'delete_others_pages' ) ) {
			$this->post = stripslashes_deep( $_POST );

			$this->register_ajax( 'red_log_show' );
			$this->register_ajax( 'red_log_hide' );
			$this->register_ajax( 'red_log_delete' );

The first edit above allows Editors to see the Redirection navigation item under the Tools menu in the admin area. The second edit allows Editors to add/edit/save redirects via the Redirection screen.

The Events Calendar Doesn’t Display Today’s Event on Upcoming Events Page

We’ve seen this issue a couple times on a few different sites. It seems to come and go and is always a major issue when it happens. The Events Calendar plugin will stop displaying today’s event on the upcoming events page and move it to the past events page which leads to chaos if you’re in the process of promoting that event. Here is a simple fix to correct this problem, remember to update this code each time you upgrade the plugin.

On line 15 of this file:
/wp-content/plugins/the-events-calendar/the-events-calendar.class.php

Replace this:

const DBDATETIMEFORMAT = 'Y-m-d G:i:s';

With this:

const DBDATETIMEFORMAT = 'Y-m-d';

The Events Calendar and Custom Post Types

The Events Calendar plugin is outstanding for tracking events within WordPress sites and blogs. The integration of templates into your own theme means you don’t risk overwriting updates each time you upgrade the plugin. This is probably the strongest event calendar plugin we’ve used, but that doesn’t mean there aren’t some tweaks that could be made. Unfortunately, all events are listed as regular posts in WordPress; this works fine, but if you’re a neat-freak like we are, you like to have everything in its own place using custom post types. Because The Events Calendar doesn’t support custom post types (yet), we have to force it a little. It’s actually pretty easy and only take a little bit of code to complete, check it out below.

On line 1029 of this file:
/wp-content/plugins/the-events-calendar/the-events-calendar.class.php

Replace this:

public function addEventBox( ) {
add_meta_box( 'Event Details', __( 'The Events Calendar', 'Events_textdomain' ),
array( $this, 'EventsChooserBox' ), 'post', 'normal', 'high' );
}

With this:

public function addEventBox( ) {
add_meta_box(
'Event Details', __( 'The Events Calendar', 'Events_textdomain' ),
array( $this, 'EventsChooserBox' ), 'post', 'normal', 'high' );
add_meta_box( 'Event Details', __( 'The Events Calendar', 'Events_textdomain' ),
array( $this, 'EventsChooserBox' ), 'events', 'normal', 'high' );
}

The word “events” on line 6 is the name of your custom post type. We use “events” because, well, they are events.

Now that the events are showing in your custom post types, you’ll need to edit the events templates, these are kept in the “events” directory within your theme. All you need to do is tweak the query to pull the custom post type, so add the following line of code right before the loop starts:

<?php query_posts('post_type=events&category_name=events&eventDisplay=upcoming'); ?>

Contact Form 7 Clear Default Value

Contact Form 7 is one of our favorite form plugins because its updated regularly and there are a ton of extensions you can install that make the user-experience that much more rewarding; our favorite is the Database Extension.  One feature that people have been asking about for quite some time is the ability to clear the default value of a field onClick or onFocus.  This can be done easily by changing a couple lnes of code in the plugin, but remember, when you upgrade Contact Form 7, you’ll need to reapply this change.

On line 89 in this file:
/wp-content/plugins/contact-form-7/modules/text.php

Replace this:

$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';

With this:

$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' onfocus="if(this.value==\'';
$html = $html . esc_attr( $value ) . '\') this.value=\'\';" onblur="if(this.value==\'\') this.value=\'' . esc_attr( $value ) . '\';" />';

And on line 88 in this file:
/wp-content/plugins/contact-form-7/modules/textarea.php

Replace this:

$html = '<textarea name="' . $name . '"' . $atts . '>' . esc_html( $value ) . '</textarea>';

With this:

$html = '<textarea name="' . $name . '"' . $atts . ' onblur="if (this.value == \'\') {this.value = \'' . esc_html( $value ) . '\';}" onfocus="if (this.value == \'' . esc_html( $value ) . '\') {this.value = \'\';}">' . esc_html( $value ) . '</textarea>';

With those 2 tweaks you should be able to clear the default value each time the user clicks the text field or text area.

Appointy Plugin (Appointment Scheduler)

We have quite a few clients that use booking tools for their business.  There are a lot of differnt options out there these days, and of course, we swing the WordPress way and look for excellent plugins that will fill our client’s needs.  Check out the description of Appointy below, we’ve played around with it a bit and we really like its flexibility and ease of use.

Accept appointments from your clients 24x7x365 on your blog. Unlike other calendar tools, this plugin allows your customers to book appointments with you directly from your blog. This service is brought to you by Appointy.com and it’s free! It has a very powerful and simple Ajax interface which allows one click booking. With just one click your clients can see your availability in the entire month. Try and find yourself.

Features:

  1. Sends SMS alert to client prior to appointment.
  2. 2 Way Sync with Google calendar.
  3. Supports multiple service booking.
  4. Works at service level i.e. your staff can perform any service at any time on any weekday.
  5. Powerful marketing tool to promote your services socially.
  6. ICal support to sync outlook or any other iCal supporting application.
  7. Allows you to accept pre-payments from your clients.
  8. Can be customized easily to fit any business needs.
  9. Can be used for service booking, resource booking, group booking and event booking.

Check out their Facebook Fan page and see what others are syaing about them.