Skip Navigation

[Escalated to 2nd Tier] Cred form in view: shortcode for video is rendered in wysiwyg: breaks player

This support ticket is created 4 years, 9 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/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 4 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1484523

I am trying to:
Edit a post body in a cred form from within a view loop, i.e. the cred form shortcode resides inside a view.
I upload an mp4 via Add media. The following shortcode is inserted in the Wysiwyg editor:

[video width="1080" height="608" mp4="**************.mp4"][/video]

I save the post: the video player works as expected.

Then I edit the same post with a cred form. Tthe WordPress video shortcode is not displayed anymore in the Wysiwyg editor field. Instead: the shortcode seems to be rendered as html, resulting in the following code:

<div class="wp-video" style="width: 1170px;">

<!-- [if lt IE 9]>document.createElement('video');<![endif]-->
<div class="wp-video" style="width: 1170px;">

<!-- [if lt IE 9]>document.createElement('video');<![endif]-->
<div class="wp-video" style="width: 1080px;"><!-- [if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video id="video-627-1" class="wp-video-shortcode" preload="metadata" controls="controls" width="1080" height="608"><source type="video/mp4" src="***.mp4?_=1" />***.mp4</video></div>
</div>
</div>

If I save the post with this new code inside it, the post is displayed again with the video player, however the player does not function anymore: it does not repond to click events.

It seems that when creating the cred form and rendering the post body inside the wysiwyg field, the standard video shortcode of wordpress is rendered as html inside the editor instead of the raw (unfiltered) shortcode. Saving this rendered html breaks the player...

We have reproduced this issue on our dev environment, with all latest versions of toolset plugins.

I hope you will be able to reproduce and fix this issue?

Thanks in advance!

#1486109

Hi,

Thank you for contacting us and I'd be happy to assist.

I was able to reproduce this behavior on my test website as well and any shortcode used inside the post content, WYSIWYG and multi-line fields of an edit form, returns the expanded output when the form is wrapped inside a post view.

In our documentation on edit forms, we recommend using them inside a separate content template for the editing a post (and not views):
https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

I've shared these findings with the concerned team for further review and will update you once I'll hear back from them.

For now, you can use the edit form inside an editing content template, without wrapping it in a view.

regards,
Waqar

#1621137

Hi, I was wondering if there has been any follow up on this issue from the concerned team.

A lot of our clients experience this issue because they are creating and editing content with front end cred forms, both inside and outside view loops, for example also on a user-form to edit their own profile.

When a user creates / edits content in the WYSIWYG type field of a cred form, the embed code for video breaks, because it is rendered as shortcode:

Shortcode in editor after inserting mp4 file with 'add media'
[video width="848" height="480" mp4="hidden link"][/video]

Content after saving the form:
<div class="wp-video" style="width: 848px;"><!-- [if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video id="video-1523-1" class="wp-video-shortcode" preload="metadata" controls="controls" width="848" height="480"><source type="video/mp4" src="hidden link" />hidden link">hidden link;

Because of this, the user can not change / edit the embedded video again, because the shortcode has been converted to html already.

We hope you can find a solution for this, because we can not move all our cred forms to seperate content templates, beacause there are just too manu forms implemented in our sites and because this also affects user forms.

Looking forward to your reply...

Thanks in advance!

#1622247

Hi,

Thank you for checking in.

Our preliminary investigations have suggested that to selectively restrict the shortcodes from not expanding inside a view, only when output is coming from a Toolset Form's field, is fairly complex and could lead to performance issues.

However, I've requested an update from the concerned team and will let you know once I'll hear back from them.

If separate content template for editing is not feasible, one alternate can be saving the video's URL in a separate "video" type field.
( ref: https://toolset.com/documentation/customizing-sites-using-php/functions/#video )

This way, you won't have to use the video shortcode inside the WYSIWYG field.

regards,
Waqar