Skip Navigation

[Résolu] conditional block with logedin user custom field….

This support ticket is created Il y a 1 année et 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par jeanL-2 Il y a 1 année et 7 mois.

Assisté par: Minesh.

Auteur
Publications
#2592111

Can you please tell us what you are trying to achieve?

I am using the conditional block to display a menu, and I want it to appear only if the logged-in user has a specific custom field checked.

This is the shortcode that displays the fields that were checked during user creation: [types usermeta='roles' separator=', ' user_is_author='true'][/types].

#2592611

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Toolset conditional block you can use to compare the post custom field. To check the user custom fields, either you can switch to the [wpv-conditional] shortcode or you can enable the advance mode for conditional block and add the condition manually.

For example:

( NOT ( empty( '[wpv-current-user info="id"]') )  AND  ( '[types usermeta="roles" output="raw" current_user="true"][/types]' = 'role_value' ))

Where:
- Replace role_value with your original role value.

If above solution does not help, please share admin access details where you want to add conditional and what role value you want to compare.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2593199

My issue is resolved now. Thank you!