Error in php snippet using tokens: Show profile field if it isn´t empty I have this core profile field in Drupal7: profile-curso-basico.
I want it to be shown in the user´s profile  only if the field has information in it (it´s a deprecated field, but some old users have data in it, and migrate modules didn´t import it properly, because it´s a hardcoded list).

I´m using panels, token and Display Suite modules. 
At the profile page, I have this panel with a special coded DS field, that has dinamic information using tokens.

If I just paste: Mi Curso: %user:profile-curso-basico I get the field information properly, but I want to show it only if profile-curso-basico field isn´t empty.

So I thought of this (the input type is PHP, so I can paste some php code):

&lt;?php if (!empty(%user:profile-curso-basico)): ?&gt;
%user:profile-curso-basico
&lt;?php endif; ?&gt;


And I´ve got this error:

Parse error: syntax error, unexpected T_LNUMBER, expecting T_PAAMAYIM_NEKUDOTAYIM in /home/liga/public_html/modules/php/php.module(80) : eval()'d code on line 9


What´s wrong with that snippet? Maybe I shouldn´t add tokens into (!empty( )) ?
How may I change that in order to work? Thanks!!
You must refer to the actual field in your snippet. Try something like:

&lt;?php 
global $user;    
if (isset($user-&gt;profile-curso-basico[LANGUAGE_NONE][0]['value'])) {
  echo $user-&gt;profile-curso-basico[LANGUAGE_NONE][0]['value'];
} ?&gt;