I'm trying to match the data of a field to a contextual value but I cannot find my desired field in the relationships list.

Do I have to something special to this field to get it to show up under relationships?

  • 1
    Where is your field at? what type of you did you create? Show: Content? Show: comments? or what? – No Sssweat Feb 10 '17 at 8:26
  • ******type of view – No Sssweat Feb 10 '17 at 15:58
  • It's a field within the custom content type, a drop down with static content. – Sam Feb 13 '17 at 6:40
  • perhaps the field is already available? have you tried adding it as a contextual filter? – No Sssweat Feb 13 '17 at 6:43
  • Yes, it is available as a contextual filter. But I need it as a relationship – Sam Feb 13 '17 at 6:44

I'm trying to have a filter that shows content where the name of logged in user is equal to the value of custom field.

Add your custom field as a Contextual Filter.

Select Provide a default value then for Type select PHP Code

PHP Contextual Filter Code

  global $user; // gets current logged in user object

  if (isset($user->name)) {      
     return $user->name; // gets user name
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.