Skip Navigation

[Resolved] Feature stopped working

This support ticket is created 3 years, 8 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by jamesB-3 3 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#2054375

Tell us what you are trying to do?
I had a conditional field to allow administrators to delete a post. It worked great. I updated the toolset plugins a few days ago and now it doesn't work.

The code is:
[wpv-conditional if=" ( ( '[wpv-current-user info="role"]' eq 'administrator' ) ) " ][cred_delete_post_link action='trash' text='Delete' message='Are you sure you want to delete this listing?' message_show='1' class='cred-refresh-after-delete'][/wpv-conditional]

Nothing else has changed.

Is there any documentation that you are following?
No
Is there a similar example that we can see?

What is the link to your site?
hidden link

#2054441

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Thank you for getting in touch. I can see an issue with how the quotations are formatted which can cause the shortcode to not parse properly.

Can you try using the one below.

[wpv-conditional if=" ( ( '[wpv-current-user info='role']' eq 'administrator' ) ) " ][cred_delete_post_link action='trash' text='Delete' message='Are you sure you want to delete this listing?' message_show='1' class='cred-refresh-after-delete'][/wpv-conditional]

Notice the use of the single quotes for the info attribute of the [wpv-current-user] shortcode.

Thanks,
Shane

#2054751

I updated to the single quote but the results are the same. The preview shows it properly comparing and matching administrator to administrator but the delete link just stopped displaying. I show the two if conditions when I inspect and both are divs with no content. (two ifs for two roles).

They are both text and field set to html with [wpv-conditional if=" ( ( '[wpv-current-user info='role']' eq 'administrator' ) ) " ][cred_delete_post_link action='trash' text='Delete' message='Are you sure you want to delete this listing?' message_show='1' class='cred-refresh-after-delete'][/wpv-conditional]

(2nd is the manager role vs administrator).

#2054753

Instead of putting the full code into the fields and text block, I added a conditional block and then put the delete link into that.

The result when viewed in html is:

[wpv-conditional if=" ( ( '[wpv-current-user info="role"]' eq 'administrator' ) ) " ]<!-- wp:toolset-blocks/fields-and-text {"editorMode":"html"} -->
<div class="tb-fields-and-text" data-toolset-blocks-fields-and-text="1">[cred_delete_post_link action='trash' text='Delete' message='Are you sure you want to delete this listing?' message_show='1' class='cred-refresh-after-delete']</div>
<!-- /wp:toolset-blocks/fields-and-text -->[/wpv-conditional]

Seems to work. I'll test further and come back to this if I find another issue.

#2054763

Wanted to add that the original code works great on another page that didn't need the conditional so it's something that seems to have changed using the conditional within the fields and text. Something with one of the latest updates? I noticed the IF icon is no longer displayed on fields and text.