我找到了解决这个问题的办法。这不是一个“修复”,而是一种解决需要同步用户角色问题的方法。我没有尝试让所有用户角色匹配,而是决定只检查主站点的用户角色。请参见下面的我的函数,了解我是如何做到这一点的:
/*
* Function to check a specified user from a subsite against
* the role of that same user on the main site
*
* @param int $site_to_check the id of the site to check the user\'s role from
* @param int $user_id the user\'s id to check
*/
function cgc_check_for_citizen($site_to_check = 1, $user_id = null) {
if(!isset($user_id)) {
return false;
}
$citizen = false;
global $blog_id;
if($blog_id == 1) { // we\'re on the main site
if(user_can($user_id, \'read_citizen\')) {
$citizen = true;
}
} else {
switch_to_blog($site_to_check);
if(user_can($user_id, \'read_citizen\')) {
$citizen = true;
}
restore_current_blog();
}
return $citizen;
}