Skip Navigation

[Resolved] I cannot get featured image in CRED form to save against post

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 26 replies, has 2 voices.

Last updated by Nigel 7 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#418582

I have a problem with uploading a featured image in a CRED form.

This is the code I have in the form:

<div class="cred-field cred-field-_featured_image">
<label class="cred-label">
Featured Image
</label>
[cred_field field='_featured_image' value='' urlparam='']
</div>

When the CRED form is loaded the user can upload an image and submit the post... all looks fine but the image does not save or does not save to the post ... does not appear in the view or the WP Admin

I have tried adding

 post='announcement' 

after

 cred_field field='_featured_image' 

but that doesn't help.

I had it working previously and have tried winding back to an earlier version of CRED 1.6 which was when it worked but no good

any ideas on this ... I am tearing my hair out...

Cheers

#418628

Nigel
Supporter

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

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

Hi Peter

I went through the steps of setting up a form to publish Announcements, a CPT I created which is I think what you are aiming to do.

I always find it best to let CRED auto-generate the forms and then edit it as required. When I did that it didn't add the featured image field, so I went back to edit the Announcements CPT and scrolled down to "Sections to display when editing Announcement" and checked featured image.

Now when I auto-generate the form it adds the field for the featured image. I saved the form, added it to a page, and then tested the form on the front-end and it worked as expected.

I would recommend you re-generate your form—or start with a new one—making sure that 'featured image' is included in the sections to display in your CPT settings.

See if that works and if it doesn't report back to me and I'll see if I can identify the problem.

#418634

Nigel

Thanks for your response.

I had already done as you suggested.

I have enabled feature image in CPT

I got the code for featured image from auto generating the form

it works on the front end but when I look at the post created no featured image is save in the new announcement post generated.

Cheers

Peter

#418714

Nigel
Supporter

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

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

Hi Peter

Could you please check your browser console for errors when loading and submitting the form.

I'm not expecting to see any because you say the form works "on the front-end" which I take to mean that the form appears to submit normally, but when you view the post in the back end it does not have the featured image assigned.

Could you also enable WP debugging. Edit the wp_debug line in your wp-config.php file so that it reads like so:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

That will generate a debug.log file in your wp-content directory which you can inspect in any text editor. Again, when loading and submitting the form does that log file show any warnings or errors?

If you could please verify that and let me know.

Thanks

#419550
Screen Shot 2016-07-26 at 3.19.28 PM.png
Screen Shot 2016-07-26 at 3.21.19 PM.png
Screen Shot 2016-07-26 at 3.22.32 PM.png

Nigel

Done that ... saw no errors on the front end.

BTW the images being uploaded make it into the media folder in the WP backend... it is just not associated with the post.

did the wp_debug thing...

I attach the debug.log file

The relevant bits ... I think are:
[26-Jul-2016 06:53:54 UTC] purge_varnish_cache() failed for: (localhost) #^(techboard\.staging\.wpengine\.com)$# #(/announcement/test-6(.*)|^/$|/feed)#
[26-Jul-2016 06:53:54 UTC] purge_varnish_cache() failed for: (localhost) #^(techboard\.staging\.wpengine\.com)$# #(/announcement/test-6(.*)|^/$|/feed)#

I also attach the two excerpts from the wp-content and wp-includes files referred to in the error log.

Any ideas?

Peter

#419652

Nigel
Supporter

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

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

Hi Peter

I don't think the deprecated notices are important. The errors from line 158 of functions.php potentially are, but your screenshot shows the lines that come after not before so I'm can't see what the code generating the error does.

Can you please switch to a default theme, e.g. twentysixteeen, and test again and check if the uploaded image is attached to the post correctly or not?

If it does work it suggests some of the custom code in your theme may be the culprit. I'll mark your next reply as private so that you can either copy and paste your functions.php file or provide ftp credentials so that I can inspect it myself.

#419953

Nigel
Supporter

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

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

Hi Peter

I have made a clone of your site for testing.

Could you confirm where I should expect to see the problem?

Which form, and on which page?

#419960

Nigel

For some reason the front end of my staging site is now entirely non-operational... white screen of death. Something you did? Backend is OK.

The image upload is in the New company announcement form ID 1564. Which can only be accessed on he front end if you are the owner of a company profile OR have been authorised by the owner to make announcements.

Step 1: go to any company profile in the back end and make WP-types the author of the post (the dropdown menu at the bottom) - save

Step 2: view the company profile on the front end - you should see "Make an Announcement" button under the company's logo. - press the button

Step 3: Complete the announcement form... use the "feature image" image upload... I have both featured and announcement image in the form for now... while I was testing. - Complete and submit the form.

Step 4: still on the front end, go to the "Explore" menu tab and select "Announcements". Open the announcement you just submitted and select edit announcement from the Admin menu at the top... You will see the featured image does not appear in the back end... But if you look at the media page in the backend... the uploaded image is there.

I hope you can help

Cheers

Peter

#419977

Nigel
Supporter

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

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

Sorry to hear about the front-end white screen, all I did was to install the All-in-One WP Migration plugin to generate a backup which I downloaded. I haven't deleted the plugin, yet. Please try that.

In the meantime I will run through the testing on my local copy.

#419996

Thanks Nigel

I deleted the plugin but still have the white screen... If you figure out the problem with the featured image upload I will need to take note of all changes made ... recopy from live to staging and make the changes again and hope it works ... not a biggie.

Peter

#420001

Nigel
Supporter

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

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

Hi Peter

Gah. My clone of your site has the white screen, I'm not sure how long it has been a problem but whatever is causing it has made it into my clone.

I'll wait to hear from you when you have a working version and I can try again, if that's okay.

#420003

I will copy again to staging again this evening... I won't be able to do that straight away though.

Peter

#420246

Nigel
Supporter

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

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

Let me know how you get on Peter and if and when I can try again with taking another backup.

#420272

Nigel it should be ready for you to try again.

I recopied from love to staging set it up as I had before and tested... With no joy.

Cheers

#420422

Nigel
Supporter

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

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

Hi Peter

Sorry to be making such slow progress on this with all the to-ing and fro-ing.

I made a test announcement and the featured image worked fine, so let's just review what I did.

I successfully created a new snapshot (having verified that it was working on the front-end first) and installed it locally.

I did as you instructed, edited a company profile ("Acaverse") to change the author to wp-types, then viewed it on the front end. When I clicked "make an announcement" it took me to the make an announcement page (with the parent_company_profile_id parameter), but then there was no form showing on that page.

I checked the browser console for errors and saw there was a JS error coming from some embedded google analytics code.

So I stripped everything back and de-activated all plugins except for Types, Views and CRED and switched to twentysixteen to be able to test this specific issue.

Going back to the company profile and clicking the make an announcement button, the page it takes me to was empty, there was no CRED form to fill in.

So I edited the page, and saw the CRED shortcode was included.

So I went to Toolset > Post Forms to check the form.

I can't show you now because it has changed, but for some reason for the New Company Announcement Form alone the column entries for Type and Post Type were empty.

So I edited the form and went through re-setting the select boxes to what I thought were the appropriate values: Create Content, Display the Post, Announcements, Published...

They were the only changes I made.

I went through the tests again, completed the form, including adding a featured image, and it was correctly attached to the announcement post.

If you want to maybe verify your form settings and let me know if you spot anything amiss, or simply re-select and re-save them.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.