I have a View (content) created with a contextual filter. The contextual (Content:Country) filter uses PHP code to check custom fields:
global $user;
$user_uid = user_load($user->uid);
$mycountry = $user_uid->field_user_country['und']['0']['tid'];
return $mycountry;
The filter is [field_address_country] == [field_user_country] The contextual filter works fine.
However, I would like to 'disable' the filer for admin (uid=1) so that I can view all nodes regardless of the field_address_country value.
I have tried adding a condition to check for uid=1 but it doesn't work
global $user;
$user_uid = user_load($user->uid);
$mycountry = $user_uid->field_user_country['und']['0']['tid'];
if ($user_uid == '1') {return 'all';}
else {return $mycountry;};
Is there a method for returning all results (or disabling the filter) for admin user?