Skip Navigation

[Resolved] Added Mime types not working in CRED frontend 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.

Tagged: 

This topic contains 25 replies, has 2 voices.

Last updated by rubenB 6 years ago.

Assigned support staff: Waqas.

Author
Posts
#293377

Hi thanks for getting back to me quickly,

Now whether or not adding a GPX file getting the error message:
The post was not saved because of the following problem:
Invalid Form Submission (nonce failure)

I've tested creating a new form with auto generated fields, just to add standard WordPress Posts,
hidden link

Now this doesn't work either....

With the previous version the form would successfully submit a post, just wouldn't allow to upload GPX. I haven't made any changes, added any plugins etc...

Sorry for the headache!

#293597

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I have tested CRED 1.3.6 thoroughly around this, on my local host and have concluded followings:

- It works perfectly fine with Types File Type Custom Field, after adding one of the following codes in functions.php file:

add_filter('file_upload_mimes','add_custom_mime_types');
function add_custom_mime_types($mimes){
	return array_merge($mimes,array (
		'db' => 'application/db',
		'gpx' => 'application/gpx',
		'xyz' => 'application/xyz'
	));
}

-- OR --

add_filter('upload_mimes','add_my_mime_types');
function add_my_mime_types($mimes){
	return array_merge($mimes,array (
		'db' => 'application/db',
		'gpx' => 'application/gpx',
		'xyz' => 'application/xyz'
	));
}

- I tested this with Custom Post Type and with Standard Post Type as well.
- The "file_upload_mimes" action works fine for CRED forms used on the front-end (only).
- The "upload_mimes" action works fine for CRED forms used on the front-end and Word Press standard media uploader (in WP Admin). So if you don't want to change standard mime-type handling in WP Admin, you can simply use "file_upload_mimes" action for front-end forms (CRED), while you can use "upload_mimes" action to add custom mime-types on both ends (front-end and admin panel).
- Standard post's image upload field (featured image) only allows to upload image fields and works fine on a CRED form. However, you can not change behavior of this featured image (standard) field to follow the mime types added in functions.php. This works for Types Custom Field of File Type.

Additionally, the link you provided for testing, leads to a 404 Not Found page after submitting the form.

Can you please confirm if you have upgraded to CRED 1.3.6 and have added one of above mentioned codes to your functions.php? You can add both codes also, but please make sure that both use different callback functions. However, the inner code can be the same for both functions.

If none of above works, and you still face the issue, please do followings:

1) Take backup of your website
2) Remove all installations of CRED (deactivate and rename CRED folder under /wp-content/plugins - this will be enough)
3) Install CRED 1.3.6 and activate. Then test for the issue.
4) If issue still persists, please allow me a temporary access to your website. So I can investigate the issue in more detail. I have set your next reply as private, please input all details in the given areas. Also mention the CRED Forms and Pages in question. The functions.php of your active theme must also be writable.

Please remember to take backup of your website always, before you provide a temporary access, thanks.

#294159

Thanks Waqas,
Sent site logins.

Also confirming I've removed and replaced Cred 1.3.6

Perhaps this caused the nonce issue having replaced the installation so many times - but form data still remaining in the database?

#294189

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for providing the access details. Please allow me some time to work on this. I will update you as soon as I find a solution.

Yes, data isn't affected during upgrades (automatic or manual). The nonce issue is also under observation by our Team, which has been reported by some clients, after upgrading to 1.3.6. I will suggest to open a separate thread for the nonce issue, so it is registered as a bug and you get appropriate support about it.

#294498

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I just visited the link you provided at hidden link and found no custom file/image type field in the form. But only the standard Featured Image field of the post.

As I mentioned "Standard post's image upload field (featured image) only allows to upload image fields and works fine on a CRED form. However, you can not change behavior of this featured image (standard) field to follow the mime types added in functions.php. This works for Types Custom Field of File Type."

So I will suggest to test the filters with Types Custom Field of File Type. These filters are not intended to add mime type support for featured image.

#294499

Hi Waqas,

I just added that page
hidden link
To test whether the nonce failure was a generic issue or somehow related to mime types.

Here is a form to post a map with a GPX
hidden link
Its set to private but if its useful to you I can set temporarily to public

#294858

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I just checked hidden link after login (as credentials you provided). Looks like it's a nonce failure issue. Unless this is resolved, the mime-type issue can't be fixed. But I suspect, the mime-type issue will work fine, once nonce-failure is resolved.

Today a new version was released for Types (1.6.6.2), although it wasn't related to this, but suspected to fix this issue for a client. So I upgraded your Types to latest one, but nonce-issue wasn't fixed.

I am reporting this thread as part of the nonce-failure bug report. It has already been reported by some clients and is currently under some resolution. Hopefully a solution will be soon out there.

I will keep you posted as soon as the solution is available. Please hold on to the mime-types test, unless the other issue is fixed, thanks.

#294859

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I have just reported the issue, I will update you soon on this. Thank you for your patience and cooperation.

#294871

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Our team is trying to access the site via FTP, but looks like FTP information isn't correct.

Can you please either provide an FTP access (correct one) or a cloned package of your site? For cloned package please install Duplicator Plugin (https://wordpress.org/plugins/duplicator/) and create a clone of your website. Then zip the package (along with installer.php) and send the download link.

I have set your next reply as private for this purpose.

#295242

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I have just sent you CRED trunk version to your email address (via WeTransfer.com). Please download and replace with your current installation of CRED. This should fix the nonce-failure issue.

Please let me know about your feedback, thanks.

#295523

Hi, the latest trunk has fixed the nonce failure issue!

Thanks so much for your patience and hard work resolving these two issues,

It took a long time but worth the wait in the end.