Skip Navigation

[Resolved] Toolset forms 2.4 issue with media library and AWS S3

This support ticket is created 5 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.

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 11 replies, has 2 voices.

Last updated by Luo Yang 5 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1318495

This refers back to https://toolset.com/forums/topic/toolset-forms-confirmation-incorrect-since-forms-2-4/

I am using Amazon Web Services S2 with the Media Cloud plugin.

I have now updated to 2.5 again and checked.

The conditionals are still not working properly in email confirmations (the condition [wpv-conditional if="( empty($(wpcf-test-field)) )"] is being evaluated as TRUE when it should be FALSE), and there remains an issue with using the media library. If a new image is uploaded, it goes into the media library and appears attached to the post but if an image is chosen from one of the existing media library entries, it does not get attached to the post.

Also, if I use a post edit form to try to attach the existing media library image again, the image appears in the form page as a "preview" but does not get attached to the post.

#1318779

Hello,

Q1) The conditionals are still not working properly in email confirmations

In Toolset Forms email notification, I suggest you use the Types shortcode insider wpv-conditional shortcode, for example:

[wpv-conditional if="( '[types field='internal-email'][/types]' ne '' )"]
Email is not empty
[/wpv-conditional]

More help:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/

Q2) there remains an issue with using the media library...

There is a known issue with Amazon Web Services, see the errata here:
https://toolset.com/errata/issues-with-saving-images-and-media-fields-in-toolset-forms-when-using-amazon-s3-and-cloudfront-plugins/
I assume we are talking about post featured image, if it is, you can try the workaround mentioned in above errata.

#1318831

Thanks Luo Yang

The errata solution for AWS appears to work intermittently only (in other words for some posts and not others) as far as I can tell. I will leave it live on my live site for the next few days and see what happens but it doesn't look stable.

On the conditional, I need to test further but this appears to work thanks.

#1319605

Update : I think the errata solution is not working for me.

If I create a post with an existing media library image chosen, the image is not properly attached. Using new images added to the media library (suing the payload tab) seem to work.

If I create a post or use a form to edit a post, when I select an image from the media library appears in the form when I select it, but it just is not getting attached.

Also, posts where there is also an attached audio file are behaving strangely; in the slider, I have a conditional to check if the thumbnail exists, and if not to insert a generic image. What is happening with a post I have just created using Forms 2.5 is that the test seems to say thumbnail exists so no generic is loaded

[wpv-conditional if="( NOT(empty($(_thumbnail_id))) )"][wpv-post-featured-image size="medium"][/wpv-conditional]
[wpv-conditional if="( (empty($(_thumbnail_id))) )"]<img src="hidden link">[/wpv-conditional]

In the case of one post just created, the generic image fails to load but there also appears to be no image attached to the post. Thus it appears as shown in the screenshot (compare to a post where there is an image in the second screenshot).

This kind of behaviour is replicated on any view which shows the post and where the views uses a conditional to check and put a generic image in where the image would have been - the generic image is not loaded.

It is as if there is something in the thumbnail but it isn't an image. And I think this is backed up by the fact that if I go into the backend to edit the featured image on the post, the screen which comes up is the third screenshot showing that in fact the featured image is an audio file! is it possible that the errata solution is somehow picking up this audio file attachment and making it the featured image?

Help!

#1319607
audio file as featured image.jpg
slider no image.png
slider normal display.png

Sorry forgot to attach the screenshots

#1319787

Since it is a compatibility problem with other plugin:
AWS S3

Please provide live test site with the same problem, fill below private message box with login details + FTP access, also point out the problem page URL, form URL and where I can edit your PHP codes:
- If I create a post with an existing media library image chosen, the image is not properly attached.
- I have just created using Forms 2.5 is that the test seems to say thumbnail exists so no generic is loaded

#1320701

Thanks for the details, I can log into your website, will update here if there is any found.

#1320953

Your website is very complicated, we can handle the questions one by one:
How and where do you put the shortcode you mentioned above:

[wpv-conditional if="( NOT(empty($(_thumbnail_id))) )"][wpv-post-featured-image size="medium"][/wpv-conditional]
[wpv-conditional if="( (empty($(_thumbnail_id))) )"]<img src="<em><u>hidden link</u></em>">[/wpv-conditional]

How and where can I see the result in front-end, please provide the problem URLs, thanks

#1322373

I use this conditional to show a generic image if there is no featured image attached to the post.

If thumbnail exists, show the image; if not, show the generic image.

You can see this on any post which has no featured image.

This isn't really the relevant bit though as this is a template which shows posts and is not related to the behaviour of the forms.

My problems are when forms is used and the user chooses an existing image from the media library:

1. With the errata solution implemented, on the podcast post type (which has an audio file attachment as well as a featured image) the audio file attachment gets considered as the featured image

2. On other post types, the featured image doesn't get attached

#1322767

As I mentioned above, your website is very complicated, since you did not provide details for where do you put the shortcode, so I have create a new post in your website, here are detail steps, please correct me if there is any missing:
1) Create a new post without featured image:
hidden link

2) in post content, display the same shortcode as you mentioned above:

[wpv-conditional if="( NOT(empty($(_thumbnail_id))) )"][wpv-post-featured-image size="medium"][/wpv-conditional]
[wpv-conditional if="( (empty($(_thumbnail_id))) )"]<img src="<em><u>hidden link</u></em>">[/wpv-conditional]

3) Test it in front-end, I can see it works fine:
hidden link
It is showing the generic image.

Is there anything missing?

#1322797

Sorry but this is not an issue I am asking you to investigate. The default image is appearing as it should.

The problem is as follows:

1. If I create a post and try to add a featured image from an existing image in the media library, the image is not attached
2. If I create a podcast post with an attached audio file and an existing image from the media library, the image is not attached and the audio file url is used as the featured image url

The problem is with Toolset Forms 2.5 and the errata for using Amazon S3. Can you please investigate. What I am saying is that the errata published and implemented by me is not working.

#1322913

The PHP codes in that errata is only an example, you will need to customize according to your website settings, for example:
After user choose a feature image, and submit the form, it will submit the file URL as feature image value in PHP variable $_POST['_featured_image'], this file URL is from your AWS S3 server, you can contact Media Cloud plugin author for this:
How to get the WordPress attachment ID using AWS S3 server URL, then use the attachment ID to update it as post's featured image.