Thanks for your help. You are right that PHP Execution was causing a conflict because with it disabled everything worked and with it enabled again I got those errors.
I found the workaround you referred to and made the two changes to PHP Execution. Unfortunately it did not seem to fix the problem.
Do I need to just chalk this problem continuing to the fact that both plugins continue to upgrade so a previous workaround just may not work anymore?
—————————————————————————————-
Just to make sure I did this right…
Your Read Me file says:
change:
add_filter('user_has_cap', array(&$this,'action_user_has_cap'),10,3);
to:
add_filter( 'map_meta_cap', array( &$this,'map_meta_cap' ), 10, 4 );
That first part is a no brainer. But the next part says:
replace function action_user_has_cap with :
function map_meta_cap( $caps, $meta_cap, $user_id, $args ) {
$object_id = ( is_array($args) ) ? $args[0] : $args;
if ( ! $post = get_post( $object_id ) )
return $caps;
if ( function_exists( 'get_post_type_object' ) ) {
$type_obj = get_post_type_object( $post->post_type );
$is_edit_cap = ( ( $type_obj->cap->edit_post == $meta_cap ) && in_array( $type_obj->cap->edit_others_posts, $caps ) );
} else {
$is_edit_cap = in_array( $meta_cap, array( 'edit_post', 'edit_page' ) ) && array_intersect( $caps, array( 'edit_others_posts', 'edit_others_pages' ) );
}
if ( $is_edit_cap ) {
$id = $post->post_author;
if ( isset( $this->cap_cache[$id] ) ) {
$author_can_exec_php = $this->cap_cache[$id];
} else {
$author = new WP_User($id);
$author_can_exec_php = ! empty( $author->allcaps[PHP_EXECUTION_CAPABILITY] );
$this->cap_cache[$id] = $author_can_exec_php;
}
if ( $author_can_exec_php )
$caps []= PHP_EXECUTION_CAPABILITY;
}
return $caps;
}
At first I assumed that you meant to replace the whole section (below) with the all the code above (except the first line "replace function action_user_has_cap with :".
function action_user_has_cap($allcaps, $caps, $args)
{
global $current_user;
// allcaps = all capabilities of the user
// caps = capabilities to check along with args[0]
// args[0] = current capability to check; args[1] = userID; args[2] = postID;
#echo '<pre>' . print_r($caps,1) .'</pre>';
#echo '<pre>' . print_r($args,1) .'</pre>';
if($args[1] == $current_user->ID)
{
switch(true)
{
case($args[0] == 'edit_post' && in_array('edit_others_posts',$caps)):
case($args[0] == 'edit_page' && in_array('edit_others_pages',$caps)):
$author_can_exec_php = true; // till better info we expect the author to have rights to execute php code
if( $args[2] && ($post = get_post($args[2])) ) // if postID is specified => check post->authors php execution rights
{
$id = $post->post_author;
if(isset($this->cap_cache[$id]))
{
$author_can_exec_php = $this->cap_cache[$id];
}
else
{
$author = new WP_User($id);
$author_can_exec_php = $author->has_cap(PHP_EXECUTION_CAPABILITY);
$this->cap_cache[$id] = $author_can_exec_php;
}
}
if( !$this->current_user_can_exec_php && $author_can_exec_php )
{
$allcaps['edit_others_posts'] = false;
$allcaps['edit_others_pages'] = false;
}
break;
// The following 2 cases are if checked always checked together with the above ones !?!?
// I've checked this for editing posts and pages in the general dialog.
// As !!very wisely!! no authorID or postID is provided with a cap check for
// edit_others_posts & edit_others_pages, one cannot tell who "the others" are
// and thus we cant decide if they are allowed to execute php code or not.
#case($args[0] == 'edit_others_posts'):
#case($args[0] == 'edit_others_pages'):
#break;
}
}
return $allcaps;
}
Despite it not working, that made sense to me that that was what I was supposed to do. But after it didn't work I tried to take the instructions literally and I replaced only function action_user_has_cap
with all of the replacement code. But that REALLY didn't work and my entire site broke down. Luckily I was able to fix it by simply downloading the PHP Execution plugin and re-uploading the one file that was changed.
Anyway, long story short, was I right in my first attempt to replace that entire section and not just the one line?