Hello, how are you?
I have a problem with conditionals using user fields.
if you look below, only one condition works, the others do not. all fields are plain text, except date, which is the same date.
can you help me?
<!-- Test -->
[wpv-conditional if="( [types usermeta='cu-nome-completo'][/types] ne '' )"]
<p>cu-nome-completo</p>
[/wpv-conditional]
[wpv-conditional if="( [types usermeta='cu-data-de-nascimento'][/types] ne '' )"]
<p>cu-data-de-nascimento</p>
[/wpv-conditional]
[wpv-conditional if="( [types usermeta='cu-ramal'][/types] ne '' )"]
<p>cu-ramal</p>
[/wpv-conditional]
[wpv-conditional if="( [types usermeta='cu-setor'][/types] ne '' )"]
<p>cu-setor</p>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-cu-nome-completo) ne '' )"]
<p>cu-nome-completo</p>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-cu-data-de-nascimento) ne '' )"]
<p>cu-data-de-nascimento</p>
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-cu-ramal) ne '' )"]
<p>cu-ramal</p> <!-- Test -->work fine<!-- /Test -->
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-cu-setor) ne '' )"]
<p>cu-setor</p>
[/wpv-conditional]
<!-- /Test -->
I'm waiting
thanks
Hello,
The dollar($) character works for post field, it won't work for user field, so you need to use shortcode to render the custom user field.
In order to use shortcodes within wpv-conditional shortcode as condition, you need to wrap those shortcodes into single quotes, and you need to avoid to use single quote in those shortcodes, so you can use double quotes in those shortcodes, for example:
[wpv-conditional if="( '[types usermeta="my-user-field"][/types]' ne '' )"]
my-user-field has value
[/wpv-conditional]
My issue is resolved now. Thank you!