Skip Navigation

[Résolu] wpv-conditional error

This support ticket is created Il y a 6 années et 5 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Marqué : 

Ce sujet contient 5 réponses, a 3 voix.

Dernière mise à jour par Shane Il y a 6 années et 4 mois.

Assisté par: Shane.

Auteur
Publications
#871960

I am using a conditional view to display a form. With the next wpv-conditional:

[wpv-conditional if="(( '[grupo_dos_contrat]' lt '3' ) AND ( '[numero_contrataciones_user_universidad]' it '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '2' ) AND ( '[wpv-post-id id='$grupo']' ne '786') AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' )) OR (( '[grupo_dos_contrat]' gte '3' ) AND ( '[numero_contrataciones_user_universidad]' lt '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '1' ) AND ( '[wpv-post-id id='$grupo']' ne '786') AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' )) OR(( '[wpv-post-id id='$grupo']' eq '786' ) AND ( '[numero_contrataciones]' lt '10' ) AND ( '[numero_contrataciones_user_universidad]' lt '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '1' ) AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' ))"][cred_form form="formulario-para-anadir-una-contratacion-1"][/wpv-conditional]

When I got [numero_contrataciones_user_universidad]=2, the form is shown, and it must be hidden. What´s the matter?

Thanks.

#872085

To debug HTML conditional please follow as outlined:

- Remove all complex code from within the Condition.
For example:

[wpv-conditional if="(( '[grupo_dos_contrat]' lt '3' ) AND ( '[numero_contrataciones_user_universidad]' it '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '2' ) AND ( '[wpv-post-id id='$grupo']' ne '786') AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' )) OR (( '[grupo_dos_contrat]' gte '3' ) AND ( '[numero_contrataciones_user_universidad]' lt '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '1' ) AND ( '[wpv-post-id id='$grupo']' ne '786') AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' )) OR(( '[wpv-post-id id='$grupo']' eq '786' ) AND ( '[numero_contrataciones]' lt '10' ) AND ( '[numero_contrataciones_user_universidad]' lt '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '1' ) AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' ))"]
  SIMPLE OUTPUT ONLY
[/wpv-conditional]

- Then, enable debug mode for the Conditional Statement:

[wpv-conditional if="(( '[grupo_dos_contrat]' lt '3' ) AND ( '[numero_contrataciones_user_universidad]' it '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '2' ) AND ( '[wpv-post-id id='$grupo']' ne '786') AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' )) OR (( '[grupo_dos_contrat]' gte '3' ) AND ( '[numero_contrataciones_user_universidad]' lt '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '1' ) AND ( '[wpv-post-id id='$grupo']' ne '786') AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' )) OR(( '[wpv-post-id id='$grupo']' eq '786' ) AND ( '[numero_contrataciones]' lt '10' ) AND ( '[numero_contrataciones_user_universidad]' lt '2' ) AND ( '[numero_contrataciones_user_grupo]' lt '1' ) AND ( $(wpcf-obra-participante-en-la-red-de-teatro-amateur) eq '1' ))" debug="true"] 
  See how I added "debug="true""
  SIMPLE OUTPUT ONLY
[/wpv-conditional]

- Now, test this condition and see what the debug outputs.

On my end, it outputs no Debug info at all, which means the condition is most likely either malformatted or runs out of execution time or similar.

Hence the next step is to start with a small condition:

[wpv-conditional if="(( '[grupo_dos_contrat]' lt '3' ))" debug="true"] 
  See how I added "debug="true""
  SIMPLE OUTPUT ONLY
[/wpv-conditional]

I see here you use Custom ShortCodes.

grupo_dos_contrat
numero_contrataciones_user_universidad
numero_contrataciones_user_grupo
numero_contrataciones

I suggest at first to debug those.
What do they output when you insert them directly in the page or post?
If you use them (and only them) does the conditional work?
If you use only the other (Toolset) ShortCodes, does the condition work?

Unfortunately, I cannot do these tests for you as it involves Custom ShortCodes I do not know the values of - let me know what the tests return!
Eventually we can then spot the issue together

#872163

This is an example I can see:

Case 1:

Numero contrataciones universidad: [numero_contrataciones_user_universidad]
[wpv-conditional if="( '[numero_contrataciones_user_universidad]' >= '2' )"]TEST[/wpv-conditional]

Display:
Numero contrataciones universidad: 2
TEST

Case 2:

Numero contrataciones universidad: [numero_contrataciones_user_universidad]
[wpv-conditional if="( '[numero_contrataciones_user_universidad]' < '2' )"]TEST[/wpv-conditional]

Display:
Numero contrataciones universidad: 2
(nothing)

Is that right????

#872872

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hello,

Yes the correct information is being displayed.

This is saying that [numero_contrataciones_user_universidad] is returning a value of 2 and in your first condition you use >= 2 so then the word TEST will be displayed.

In your second condition you set it to only display if the value is less than 2

Thanks,
Shane

#874458

I'm sorry, I have a mistake explaining you my case. I can see this:

Case 1:

Numero contrataciones universidad: [numero_contrataciones_user_universidad]
[wpv-conditional if="( '[numero_contrataciones_user_universidad]' >= '2' )"]TEST[/wpv-conditional]

Display:
Numero contrataciones universidad: 2
(nothing)

Case 2:

Numero contrataciones universidad: [numero_contrataciones_user_universidad]
[wpv-conditional if="( '[numero_contrataciones_user_universidad]' < '2' )"]TEST[/wpv-conditional]

Display:
Numero contrataciones universidad: 2
TEST

It seems very strange...

#877493

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hello,

Yes this is strange for real.

Would you mind providing me with access to this page so that I can assist better with this ?

The private fields have been enabled.

Thanks,
Shane

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance