Checking with user attribute

Permalink
Hi,

I have a very strange problem.

I'm using the user attributes to show certain data on a page.
The code:
$ua = UserAttributeKey::getByHandle('my_attribute');         
if ($profile->getAttribute($ua)) == 'option1') {
  echo "something";
} elseif ($profile->getAttribute($ua)) == 'option2') { 
  echo "something else";
}

The attribute "my_attribute" is a selection. When echoing the value directly, I see the values "option1" and/or "option2". But when I want to check which is selected I get nothing!

Seems that the if statement blocks the value in some way.

Can anybody help me with this problem?

Best,

Corretje

DeWebmakers
 

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.