Skip Navigation

[Resolved] Views still cached when used in Elementor Shortcode widget with cached=off

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.

This topic contains 2 replies, has 2 voices.

Last updated by simonM-5 3 months, 2 weeks ago.

Author
Posts
#2745621
Screenshot 2024-09-13 at 14.08.23.png

Dear Support

We are trying to encourage users to fill out a field in their nanny/family profiles by displaying a warning to them that a certain field is empty on their dashboard.

I tried creating a new view, which tests if a field is empty or not with a conditional. If empty, it should display a message to the user, however the message is ALWAYS being displayed whether the field is empty or not.

I thought at first this could be due to caching, so I substituted the Elementor Toolset View Widget with the Elementor Shortcode widget, and specified the view name with cached option set to off, like this:

[wpv-view name="nanny-about-me-empty-view" cached="off"]

The page the view is displayed on (my-dashboard) is also set in WP Rocket options to "Never cache this page".

Example View: "Nanny ABOUT ME empty View" (nanny-about-me-empty-view)
Page it's displayed on: "My Native Nanny Dashboard" (my-dashboard), edited with Elementor

I am also unsure of the correct placement of the query test within the Loop Editor, or whether I need a Content Template or not. There is only ever ONE nanny record or family record per user, so I don't think I need to "loop through" all the Nanny or Family records, since the Query Filter is set to "Select posts with the author the same as the current logged in user." However it may be that using a Content Template might be the correct way to go, and place the conditional in the Content Template.

I have tried this in the Loop Editor without success, with no Content Template:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
		</wpv-loop>
	<!-- wpv-loop-end -->
		[wpv-conditional if="( $(wpcf-nanny-user-about-me) eq '' )"]
			  [wpml-string context="toolset-views-29275"]Please complete the ABOUT ME section in your <a href="<em><u>hidden link</u></em>">Nanny Profile</a>.[/wpml-string]
		[/wpv-conditional]
	[/wpv-items-found]
	[wpv-no-items-found]
	[/wpv-no-items-found]
[wpv-layout-end]

I also tried this for the Loop Editor:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
		[wpv-post-body view_template="loop-item-in-nanny-about-me-empty-view"]
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
	[/wpv-no-items-found]
[wpv-layout-end]

and put the conditional in the Content Template, also with no success:

[wpv-conditional if="( $(wpcf-nanny-user-about-me) eq '' )"]
	  [wpml-string context="toolset-views-29275"]Please complete the ABOUT ME section in your <a href="<em><u>hidden link</u></em>">Nanny Profile</a>.[/wpml-string]
[/wpv-conditional]

So I'm unsure whether it's a cache issue, or whether the view is not working as expected. Please help us to understand why the view is not working.

Thanks and kind regards
Simon

#2745671

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Simon

I'm not sure what the problem is.

It looks like you want to display the message "Please complete the ABOUT ME section..." on the dashboard if a user has not completed the About Me section.

It works.

The test user you provided had not completed the section. I edited their profile to add a few words to that section, and the revisited their dashboard page and the message disappears.

You do need a View for this, to provide the context of the profile post for the current user where the conditional test will be evaluated.

You could have added the wpv-conditional shortcode directly between the wpv-loop tags, the inline template being used is effectively redundant, but it isn't doing any harm.

#2745689

HI Nigel

Thanks for the notes about the Content Template. I really cannot understand why it is suddenly working, but I tested it many times before opening the ticket hand and was not able to get the message to disappear.

Anyway Iooks resolved from my testing.

Thanks and have a great weekend
Simon