sure here is a boiled down code snipet
add_action('wp_ajax_nopriv_feeditor', array(__CLASS__, 'ajax_handler'));
static function ajax_handler() {
if (isset($_REQUEST['_ajax_nonce']) || isset($_REQUEST['_wpnonce']))
check_ajax_referer(self::$nonce); //dies('-1') if bad nonce
else
die('-1'); //no nonce = bad nonce
//get action
$action = sanitize_title($_POST['feeditor_action']);
//get id
$id = absint($_POST['id']);
if (!$id)
die('-2'); //no id
//set user to anon if they are not logged in
if (!is_user_logged_in()) {
wp_set_current_user(self::$anon_user_id);
$visitor = true;
}
else
$visitor = false;
//go
switch ($action) {
case 'load':
//get post, type, and lock
$the_post = get_post($id);
$type = get_post_type($id);
$lock = wp_check_post_lock($id);
//if post and( (user can read and revisionary) or user can edit)
if (isset($the_post) && ( (current_user_can('read_' . get_post_type($id), $id) && class_exists('Revisionary') && rvy_get_option('pending_revisions')) || current_user_can('edit_' . get_post_type($id), $id))) {
//generate response
die(json_encode($response));
}
else
die('-2');
default:
die('-4');
}
}
when i put
die(json_encode(array(
'the_post' => $the_post,
'current_user_can_read_'. get_post_type($id) => current_user_can('read_' . get_post_type($id), $id),
'class_exists' => class_exists('Revisionary'),
'pending_revisions' => rvy_get_option('pending_revisions'),
'current_user_can_edit_'. get_post_type($id) => current_user_can('edit_' . get_post_type($id), $id)
)));
it shows current user read as false with role-scoper on.
I appreciate your help on this.