Posts Tagged ‘Redirection’

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.