From: Laury GvR Date: Wed, 4 Mar 2015 14:44:31 +0000 (-0500) Subject: Fixing ajax calls X-Git-Tag: v1.0.0^2~9 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=ff4e7eb8bd9f75d69158a8d3d4dd7095b6debbfa;p=WP-Themes%2FTomsMomsCookies.git Fixing ajax calls --- diff --git a/functions.php b/functions.php index e20ccb7..be8941e 100755 --- a/functions.php +++ b/functions.php @@ -130,13 +130,13 @@ add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 48;' ), 20 ) function redirect_user_on_role() { - if(isset($_REQUEST['action'])): + if(!isset($_REQUEST['action']) && !current_user_can('publish_pages')): do_action( 'wp_ajax_' . $_REQUEST['action'] ); do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); + wp_redirect( home_url() ); exit; endif; if (!current_user_can('publish_pages') ) { /* A non-admin, non-editor */ - wp_redirect( home_url() ); exit; } //If login user role is Subscriber // if ($current_user->user_level !== 0)