Skip Navigation

[Résolu] Issue with Conditional Block and Author Profile Image

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

Use custom user field in conditional block.

Solution:

You will need to use "Expert mode" of Toolset conditional block, see my screenshot:

https://toolset.com/forums/topic/issue-with-conditional-block-and-author-profile-image/#post-1877869

Relevant Documentation:

This support ticket is created Il y a 3 années et 4 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Marqué : 

This topic contains 2 réponses, has 2 voix.

Last updated by Darryl Il y a 3 années et 4 mois.

Assisted by: Luo Yang.

Auteur
Publications
#1877443
Edit%20Content%20Template%20‹%20Kamloops%202020-12-15%20at%201.03.29%20PM.me%20—%20WordPress%20-%20Google%20Chrome[1].png

I am trying to use the conditional block to see if the author of the current post has a profile image.

Pic of settings uploaded.

I'm reading the settings (in pic) as, if the author of the current post does not have a profile image, display the stuff in the conditional block.

I have an additional conditional block with the same conditions but with the "not" enabled.

Whether or not the post's author has a profile image, it always thinks they don't.

Bonus additional settings video: hidden link

#1877869
Advanced-Editor.JPG

Hello,

I assume we are talking about a custom user image field "Advanced Editor", if it is, you will need to use "Expert mode" of Toolset conditional block, see my screenshot: Advanced-Editor.JPG.

for example:
No image:

  ( ( '[types usermeta="profile-image" output="raw" user_is_author="true"][/types]' eq '' ) ) 

Has image:

  ( ( '[types usermeta="profile-image" output="raw" user_is_author="true"][/types]' ne '' ) ) 

Please replace "profile-image" with your custom user image field slug,

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
Click link "Usage examples"
user_is_author:
"true" - output field for current Post author

#1878711

That did not seem to work.
What I ended up doing was inserting a template containing:

[wpv-conditional if="( '[wpv-post-author format="profile_picture"]' ne '' )"][wpv-post-author format="profile_picture" profile-picture-size="200"][/wpv-conditional]
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.