Registration Fields not saving in Profile

Hi All

I have two additional fields that I have coded in to stripe-checkout-form.php (which is in my theme directory to overwrite the plugins own)

<div class="form-group row">
    <label class="col-sm-4 control-label" for="findSelect">How did you hear about us?</label>
    <div class="col-sm-8">
	<select class="form-control" name="findSelect" id="findSelect" aria-required="true">
		<option selected>Choose...</option>
		<option>Search Engine</option>
		<option>Friend &amp; Family</option>
		<option>Facebook Ad</option>
		<option>Blog or Website</option>
		<option>Other</option>
	</select>
    </div>
</div>
<div class="form-group row">
	<label class="col-sm-4" for="acceptterms"></label>
	<div class="col-sm-8">
		<div class="form-check">
			<label class="form-check-label">
				<input id="acceptterms" name="acceptterms" class="form-check-input" type="checkbox" aria-required="true"> I have read and agree to the <a href="#">Terms and Conditions</a>
			</label>
		</div>
	</div>
</div>

I have also created mu-plugins/s2-store-custom-pro-form-fields.php which contains the following:

add_action('ws_plugin__s2member_during_configure_user_registration', function ($vars = array())
{
  $user = $vars['user']; // A WP_user object instance.
  $_p   = stripslashes_deep($_POST); // $_POST vars via form submission.

  if(!empty($_p['findSelect']) && is_string($_p['findSelect']))
      update_user_option($user->ID, 'findSelect', esc_html($_p['findSelect']));

    if(!empty($_p['acceptterms']) && is_string($_p['acceptterms']))
      update_user_option($user->ID, 'acceptterms', esc_html($_p['acceptterms']));
});

And I have taken the above from the examples here: https://s2member.com/kb-article/s2member-pro-forms/#customizing-pro-forms

Unfortunately whatever I set in that drop down field, it doesn’t display in the new users profile.

Any help would be appreciated, thanks.

Adrian

Why not to use s2M’s native “custom profile fields”?

I needed to be able to develop the themes consistently with the rest of the theme and all the other forms i’ve developed, so decided to do it direct in the template file.

Any ideas why it’s not working?

Adrian

Any help appreciated, this is the final piece of the puzzle which is holding the site back from going live.

Thanks

Hi
I am having the same issues.

I talk about “Dashboard -> s2Member -> General options -> Registration/Profile Fields & Options”.

Only because I like to be able to edit the syntax of the fields, and if I use “Dashboard -> s2Member -> General options -> Registration/Profile Fields & Options” then I don’t know what file I need to edit, I thought it may be s2member/src/includes/classes/cunstom-reg-fields.inc.php but I cant find the title “Additional Info” in that file so don’t think it’s the right one.

I think yours is the right approach. But what I’d suggest is that you still create those fields as @krumch suggests. Then s2Member will know about them, and you won’t need your s2-store-custom-pro-form-fields.php file.

You can still use your own form, provided that you have made sure that your IDs match the ones you put into s2Member. The best way to do that is to change the name of your own file temporarily (e.g. add -new) and then see how the s2Member-produced form looks by using the View Page Source tool in your browser on the relevant page.

Then you can edit your own form until you are sure everything that needs to match does so, and then you can re-name your file to stripe-checkout-form.php

While you’re about it, can I ask that you also take the trouble to make your form more accessible by changing every tabindex value to 0?

1 Like