Skip Navigation

[Resolved] Issue with Conditional Block and Author Profile Image

This thread is resolved. Here is a description of the problem and solution.

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 3 years, 11 months ago. 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.

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)

This topic contains 2 replies, has 2 voices.

Last updated by Darryl 3 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#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]