Skip Navigation

[Closed] [wpv-conditional] in Events Manager Form

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 6 replies, has 3 voices.

Last updated by Christopher Amirian 2 months, 2 weeks ago.

Assisted by: Christopher Amirian.

Author
Posts
#2732345

a.R

Hi 🙂

In an Events Manager Form, this won´t be displayed at all, although we have "Decode Shortcode Content" activated, and "Sanitize shortcode content?" deactivated. [wpv-user field="ID"] and [wpv-post-author format="meta" meta="ID"] have correct results.

	[wpv-conditional if="( '[wpv-user field="ID"]' eq '[wpv-post-author format="meta" meta="ID"]' ) OR ( '[wpv-current-user info="role"]' eq 'administrator' ) OR ( '[wpv-current-user info="role"]' eq 'editor' )"]
	<a class="button" href="<em><u>hidden link</u></em>">Diese Veranstaltung ändern</a>	<br>
	[/wpv-conditional]
#2732367

a.R

[wpv-conditional] works, but something seems to be wrong.

[wpv-conditional if="( '[wpv-user field="ID"]' eq '[wpv-post-author format="meta" meta="ID"]' )"]
<p>User is the author of the post.</p>
[/wpv-conditional]

doesn´t work, although the both values are equal.

#2732368

a.R
[wpv-conditional if="1 eq 1"]JAAA[/wpv-conditional]

works.

#2732665

a.R

Maybe I should better call it an Events Manager Template - for a single event - where we want to use this conditional output.

#2732838

Nigel
Supporter

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

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

Hi there

When testing conditionals like this, one useful thing to do first is to simply output on the screen the things you are comparing, to confirm that they do output the values you expect in this context.

e.g. just output this to verify

<p>[wpv-user field="ID"] | [wpv-post-author format="meta" meta="ID"]</p>

Next, you can have problems with mixing types of quotes.

If you look at this and read from left to right

[wpv-conditional if="( '[wpv-user field="ID"]' eq '[wpv-post-author format="meta" meta="ID"]' )"]

The if condition begins with the first double-quote, which is looking for the next double-quote to close the if condition. From left to right it finds a double quote at field="ID", closing the if condition prematurely.

Try replacing the double quotes used with the shortcode attributes (field, format, meta) with single quotes.

#2733556

a.R

Hi Nigel, thank you so far.
Yes I´ve looked at the values. They are correct.
Would it REALLY close the condition, after having found ONLY ONE single quote??

#2737113

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Sorry for the late reply, using single quotes should do the trick but again make sure you use double quotes only for the If statements and the single quotes for the attributes of the shortcodes.

Thanks.

The topic ‘[Closed] [wpv-conditional] in Events Manager Form’ is closed to new replies.