Skip Navigation

[Resolved] "Set checked by default (on new post)?2" is still not working after update

This support ticket is created 7 years, 2 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 8 replies, has 2 voices.

Last updated by John Mac 7 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#486036

I am trying to:
Set a Post Field as "Set checked by default (on new post)?" to yes, but it's not working.

I'm having a post-type with a group of fields displaying for admins only. I have a checkbox there, which is selected for "Set checked by default (on new post)?".

I have a CRED form for new users to create an online profile, but when this form is submitted. This checkbox is not saved as on by default.

It used to do that before. And now I don't know what to do.

I noticed that this was an issue in an earlier version of WP Types, but should be fixed now. But nothing is changed here.

#486082

Dear Johnny,

How do you setup the custom checkbox field? Did you put the checkbox field into CRED form?

I suggest you setup the shortcode of checkbox field in CRED form, add attribute "value" in the shortcode "cred_field", for example:
1) Edit the custom checkbox field, option "Value to store" set as "1"
2) In the CRED form, setup the shortcode like this:
[cred_field field='test-check' post='post' value='1' urlparam='']

Then the checkbox field will be checked by default in the CRED form.

#486297

Hi there!

This is how I set up this checkbox to my CPT for user profiles:
hidden link

These fields are only available for admins, here:
hidden link

It's just to be able to disable the visibility of that post, frontend.

Like I said, this used to work fine.

#486496

Thanks for the details, I tried the settings of your screenshot in my localhost, it works fine:
after submit the CRED form, this checkbox is saved as on by default.
Please try these in your own website:
1) you are using the latest version of WP-TYPES plugins, especially the Types + CRED plugins
2) deactivate other plugins and switch to wordpress default theme, and test again
3) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data).
https://toolset.com/documentation/user-guides/debugging-types-and-views/

#486770

Good day,

I had a look at this, but nothing helps.

1. All plugins are always udpated.
2. I have deactivated all plugins except Toolset and tried. Also switched to Twenty Seventeen.
3. Debuging mode have been on for some time. The file in the root does not contain anything exciting. But there is also one file in wp-content. hidden link

So not much cool stuff to bring to the table. Don't know what to do next. But I have a feeling that the field been used, and used to work, is somehow been "stuck" in the DB, not doing what it's suppose to do.

#486792

Hi,

I just wanted to share an update here. I tried this evening to just delete that post field for that CPT, and add a new one using a different field slug. Settings just like before, but nothings saves.

#486884

Please duplicate same problem in a test site, and fill below private detail box with login details, also point out the problem page URL and CRED form URL, I need a live website to test and debug. thanks

#488792

Since you did not put the custom checkboxes field "profile-active-by-admin" into CRED form(ID:196), so when user submit the CRED form, the field value is empty, when you edit the post in admin side, it is a existed post, it isn't a new post, as a result, and field "profile-active-by-admin" display as unchecked status.

You can try one of below options:
1) Use CRED action hook "cred_save_data" to setup the custom checkbox as checked, see document:
cred_save_data
https://toolset.com/documentation/user-guides/cred-api/#csd

2) Add the checkboxes field "profile-active-by-admin" into CRED form, setup it as checked status, and hide it with CSS codes,for example:

<div style="display:none">
[cred_field field='profile-active-by-admin' post='behandler' value='Yes' urlparam='']
</div>
#491575

Hi Luo,

Busy as usual with too much client work.

I was sure this was working fine before without adding the field to the form. But anyway, I did it now and just hide the field with css inline.

It's finally working now 🙂 Thanks.

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