Skip Navigation

[Resolved] Display conditional shortcode on User Profile type based on type view

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

Problem:

I need to output a link based on the comparison of the usermeta and wpv-found-count.

Solution:

You can setup [wpv-conditional] shortcode like this:

https://toolset.com/forums/topic/display-conditional-shortcode-on-user-profile-type-based-on-type-view/#post-2047245

Relevant Documentation:

https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-conditional

This support ticket is created 3 years, 6 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.

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)

This topic contains 2 replies, has 2 voices.

Last updated by MargeP6083 3 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2046977

I am trying to output these 3 Notice Post Type items via block on User profile type post. (View with Select posts with the author the same as the current logged in user.) Number 1 doesn't output anything (block editor or output editor). Items 2 and 3 can output via Output editor only, which is fine. I need to output a link based on the comparison of the usermeta and wpv-found-count.

I'm using this guide: https://toolset.com/forums/topic/how-to-extend-the-forms-woocomm-plugin-to-prepay-for-single-and-packs-of-post/#post-1463463

1. [wpv–conditional if="('[wpv-found-count]' lt '[types usermeta='notice-post-number' format='FIELD_VALUE' current_user='true'][/types]')"]Click this link to Post a Notice[/wpv–conditional]
2. Total Credits Purchased: [types usermeta='notice-post-number' format='FIELD_VALUE' current_user='true'][/types]
3. Total Credits Used: [wpv-found-count]

----------------------Loop Editor---------------------
[wpv-layout-start]
[wpv-items-found]
[wpv-found-count]
[types usermeta='notice-post-number' format='FIELD_VALUE' current_user='true'][/types]
<!-- wpv-loop-start -->
<wpv-loop>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[/wpv-no-items-found]
[wpv-layout-end]
----------------------------------------------------------

What is the link to your site? hidden link

How can I show the result of the conditional comparison?
Is the Output editor the only way do do this?

Thank you!
Marge

#2047245
Loop-Editor.JPG

Hello,

Please try to modify the [wpv-conditional] shortcode as below:

[wpv-conditional if="( '[wpv-found-count]' lt '[types usermeta="notice-post-number" format="FIELD_VALUE" current_user="true"][/types]' )"]
Click this link to Post a Notice
[/wpv-conditional]

You can put above codes into view's section "Loop Editor", between shortcodes [wpv-layout-start] and [wpv-items-found].

See my screenshot Loop-Editor.JPG

#2048703

My issue is resolved now. Thank you!