出于某种原因,我似乎无法从以下代码中获取任何用户...它有什么问题吗?我得到的只是“FUBAR”......
function current_user_access_level($type, $object) {
if ( $type == 'users' ) {
if ( empty( $object) ) {
$return = 'FUBAR';
} else {
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
$user_access_level = get_user_meta($user_id, 'wpcf-member-access-level', true);
switch ($user_access_level) {
case 1:
$return = '1';
break;
case 2;
$return = '2';
break;
case 3;
$return = '3';
break;
case 4;
$return = '4';
break;
}
}
}
return $return;
}