Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › If no restrictions, user sees everything › Reply To: If no restrictions, user sees everything
27/07/2016 at 16:37
#2583
NewCollege Communications
Participant
I ended up with
function filter_users_for_no_community($null,$object_id,$meta_key,$single){
global $wpdb;
$theMeta = $wpdb->prefix . 'ure_categories_list';
if($theMeta === $meta_key){
remove_filter( 'get_user_metadata', 'filter_users_for_no_community', 10 , 4 );
$cats = get_user_meta($object_id,$meta_key,$single);
add_filter( 'get_user_metadata', 'filter_users_for_no_community', 10 , 4 );
if(!$cats){
$value = '99999999';
}
}
return $value;
}
add_filter( 'get_user_metadata', 'filter_users_for_no_community', 10 , 4 );
thanks for your help