Skip Navigation

[Resolved] Field Values not being saved (CRED User Forms and CRED Commerce)

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Author
Posts
#459883

Hi,

The below is a continuation of a conversation started in the comments section of a recent membership tutorial with author Agnes Bury - https://toolset.com/2016/10/create-membership-site-toolset-new-tutorials-available/comment-page-1/#comment-306091.

Objective: Use a Toolset User Form and WooCommerce Subscriptions to support the creation of a paid membership community. I want to use the User Form to collect information such as name, gender/sex, nationality, etc. I then want to use Ultimate Member to display the information via user profiles.

I set up a Toolset User Form using the following steps:
1. Add a user field (in Types)
2. Create a User Form (CRED) that includes that field
3. Connect this form with WooCommerce payment
4. Create a page with that form
5. Submit the form, filling out the user field you created in #1.
6. Fill out the WooCommerce form.
7. Mark the WooCommerce order as completed.

I have the following fields:
- Nationality (wpcf-nationality) – a Types User Field of type Radio
- Top Activates (top_activities) – a Types Generic Field of type Multi-select
- Sex (sex) – a Types Generic Field of type Radio

NB part of the reason I am using Generic Fields is because Types does not support mulit-select User Fields - https://toolset.com/forums/topic/multiselect-user-fields-2/.

My User Form code is as follows:

[creduserform class='cred-user-form cred-keep-original']

	[cred_field field='form_messages' value='']

	<div class="cred-field cred-field-first_name">
		<label class="cred-label">First Name</label>
		[cred_field field='first_name' post='user' value='' urlparam='']
	</div>

	<div class="cred-field cred-field-last_name">
		<label class="cred-label">Last Name</label>
		[cred_field field='last_name' post='user' value='' urlparam='']
	</div>

	<div>
      <label class="cred-label">Nationality</label>
[cred_field field='nationality' post='user' value='' urlparam='']
	</div>

	<div>		
      	<label class="cred-label">Gender</label>
        [cred_generic_field field='sex' type='radio' class='' urlparam='']
        {
        "required":0,
        "validate_format":0,
      	"persist":1,
        "default":[],
        "options":[
        {"value":"male","label":"Male"},
        {"value":"female","label":"Female"}
        ]
        }
        [/cred_generic_field]
	</div>

    <div>
        <label class="cred-label">Top Activities</label>
      	[cred_generic_field field='top_activities' type='multiselect' class='' urlparam='']
        {
        "required":0,
        "validate_format":0,
        "persist":1,
      	"default":[],
        "options":[
        {"value":"managing","label":"managing"},
        {"value":"analysing","label":"analysing"},
      	{"value":"writing","label":"writing"}
        ]
        }
        [/cred_generic_field]
	</div>

	<div class="cred-field cred-field-user_email">
		<label class="cred-label">Email</label>
		[cred_field field='user_email' post='user' value='' urlparam='']
	</div>

	<div class="cred-field cred-field-user_pass">
		<label class="cred-label">Password</label>
		[cred_field field='user_pass' post='user' value='' urlparam='']
	</div>

	<div class="cred-field cred-field-user_pass2">
		<label class="cred-label">Repeat Password</label>
		[cred_field field='user_pass2' post='user' value='' urlparam='']
	</div>

	[cred_field field='form_submit' value='Pay' urlparam='']

[/creduserform]

When using my User Form and WooCommerce, Nationality is stored – I can see it using a plugin the displays usermeta. However, it does not display on the Ultimate Member profile. Top Activities and Sex are not stored at all. However, when I use THE SAME FORM without WooCommerce, I get different results. I still get the same result for Nationality, but this time Top Activities and Sex are both viewable via the usermeta – hidden link – AND the Ultimate Member profile – hidden link. This would seem to suggest that the combination of Toolset CRED and WooCommerce is not working properly.

I am happy to give you admin access to my site, if that would help.

Thanks,
Richard

#460080

Dear Richard,

I can not duplicate same problem, both two user fields (top_activities and sex) can be saved into databases.

Are you using Types plugin to create above tow user fields (top_activities and sex) ? if it is, you will need to add slug "wpcf-" before the field slug, so it should be wpcf-top_activities and wpcf-sex.

So in your CRED form, you can modify it as below:

[cred_generic_field field='wpcf-sex' type='radio' class='' urlparam='']
...
 [cred_generic_field field='wpcf-top_activities' type='multiselect' class='' urlparam='']
#460087

Hi Lou,

I did not create top_activities and sex via Types. One of the main reasons why, is that top_activities has to be a multiselect field and neither User Fields nor Form Fields supports a multiselect field type. How did you create yours?

Also, why do top_activities and sex work when I detach WooCommerce from the form? That would suggest it is not to do with the field names. Can you please confirm you tested with WooCommerce.

rt.

#460355
2252.JPG

Q1) How did you create yours?
You can try with Custom checkboxes field, which is also a multiple choices option
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes

Q2) Can you please confirm you tested with WooCommerce.
Yes, I just tested with CRED + CRED commerce + Woocommerce, and I can see both fields have been saved into databases, see screenshot 2252.JPG

#460396

Luo

1. As per my recent conversation with Juan - https://toolset.com/forums/topic/multiselect-user-fields-2/ - checkboxes are not suitable for my requirement. The purpose of top_activities is to allow a user to select their top five skills from a defined list. Checkboxes will not work, as I have a long list of skills for the user to choose from.

2. From your screenshot I can’t see wpcf prefix on top_activities. Is that a User Field, a Form Field or a Generic Field? If it is a Generic Field, please share your User Form code.

If it is not a Generic Field, then because I can’t use checkboxes for top_activities, it is looking like I can’t use Toolset at all, which is a shame. On this note, could you please explain why/confirm that Generic Fields are supported on User Forms when used with CRED but not when used with CRED Commerce.

Thanks,
Richard

#461011

Q2) I am using same codes as you mentioned in the first post:
https://toolset.com/forums/topic/field-values-not-being-saved-cred-user-forms-and-cred-commerce/#post-459883
So it is a Generic Field.

If you still need assistance for it, please try these:
1) Deactivate other plugins and switch to wordpress default theme, and test again.
2) If the problem still exists, please duplicate same problem in a test site, and fill below private detail box with credentials of the test site, also point out the problem page URL and CRED form URL, I need to debug in a live website. thanks

#462082

Luo,

As instructed, I deactivated all my other plugins except for the Toolset and WooCommerce ones, and switched to Twenty Sixteen, but the problem persists.

I have created an admin account for you. The private section of this message is not showing, so please email me at richardtandoh [at] yahoo.com so I can send you logon details.

rt.

#462115

I enabled the private detail box, please fill it with credentials of the test site, also point out the problem page URL and CRED form URL, I need to debug in a live website. thanks

#462599

Thanks for the details, I just tested in your website, it works fine, please correct me if there is anything missing:
1) Create a user with CRED form in URL:
hidden link
Complete the payment
2) Confirm the order in admin side:
hidden link
3) Check the new user with "Meta Editor":
hidden link

I can see all three custom user fields sex (generic), nationality (user) and top_activities (generic) have been setup with values

#462706

Luo,

Thanks for getting back to me.

The only time I can get your steps to work is if I follow them whilst logged in as an admin, which I think is how you tested it – I can see your user (xgren@qq.com) was created by your admin account (Luo Yang) [hidden link;. This is not a realistic test, as site users are not going to be admins.

Could you please test again when not logged in as an admin. I think what you will find now is that the user is created regardless of the fact that the order is pending and the fields – sex (generic), nationality (user) and top_activities (generic) – are not stored.

One thing I noticed is that the users where the fields save have a role type of Premium Member, whilst the others are of role type Subscriber. However, I wrote some code to set users to type Premium Member and yet the fields still do not save. I think the real clue lies in the fact that the user is being created regardless of the order status.

I look forward to hearing from you again.

rt.

#463036

Thanks for the details, I am checking in your website, will feedback if there is anything found.

#463077

I can see the problem in your website.
so I export the settings of Types + CRED from your website, and import into my localhost, and it works fine, all three custom user fields sex (generic), nationality (user) and top_activities (generic) can be saved into database.

Then I back to your website, I found this problem:
the user was created after user complete the checkout, which is abnormal, according to the setting of CRED user form:
hidden link
section "User status when the payment status updates"
the user should be created after Purchase complete (the order is complete).

Then I found there are two other plugins in your website, and I disabled them, and test again by below steps:
1) Logout as a visitor, Create a user with CRED form in URL:
hidden link
Complete the payment,

2) Login as an administrator, I can see the new user was not created.

3) Confirm the order in admin side:
hidden link

4) Check the new user with "Meta Editor":
hidden link
all three custom user fields sex (generic), nationality (user) and top_activities (generic) can be saved into database.

Please test again, check if it is fixed or not.

#463106

As I pointed out myself, the issue seems to be that when using CRED + WooCommerce Subscriptions, the user is created regardless of the order status - or before the order completes.

One of the two plugins you deactivated is WooCommerce Subscriptions and you seem to have changed my subscription product to a normal product. My issue is all about the compatibility of CRED and WooCommerce Subscriptions, so it is pointless to test without using WooCommerce Subscriptions/subscriptions.

So, from my point of view, nothing has changed. When using CRED + WooCommerce Subscriptions, my sex (generic), nationality (user) and top_activities (generic) fields still do not save.

#463157

Thanks for the details, I can duplicate same problem in my localhost with CRED + CRED commerce + Woocommerce + Woocommerce Subscriptions, and escalated this thread to our 2nd supporters, hope there is fix or workaround for it.

#465019

Here is the feedback from our 2nd supporters:
this is because the user does not use a SIMPLE WOOCOMMERCE Product with the CRED subscription.
Anyhow, you can also use the SIMPLE SUBSCRIPTION product type but NEEDS to choose "virtual" product type.

The forum ‘Types Community Support’ is closed to new topics and replies.