During our registration process a member will pick the state they live in from a drop-down. This will automatically enter in their stage chapter name (hidden field) in the database. On the checkout page if we want to save all this all of our custom fields are disappearing and the only field that gets saved is the chapter. Below is the code any help would be appreciated.
ID.' magazine: '.$_POST['magazine'].' chapter: '.esc_html($_POST['chapter']).' donation: '.$_POST['donation'].' stateName: '.$_POST['stateName'].' state: '.$_POST['state'];
wp_mail ("test@test.com", "hook data", $body);
if(!empty($_p['chapter']) && is_string($_p['chapter']))
{
// Get an array of all the users' s2Member Custom Fields
$custom_fields = get_user_option('s2member_custom_fields',$user->ID);
// Set the value for a specific field (custom_fields is an array)
$custom_fields['chapter'] = esc_html($_POST['chapter']);
// Update the Custom Field data
//update_user_option($user->ID, 's2member_custom_fields', $custom_fields);
}
if(!empty($_p['donation']) && is_string($_p['donation']))
{
$wpdb->insert('wp_donations', array('user_id' => $user->ID, 'donation_amount' => $_p['donation']), array('%d', '%d'));
}
if(!empty($_p['magazine']) && is_string($_p['magazine']))
{
$expdate = new DateTime('now');
$expdate->add(new DateInterval('P1Y'));
$wpdb->insert('wp_magazine', array('user_id' => $user->ID, 'expiration_date' => $expdate->format('Y-m-d H:i:s')), array('%d', '%s'));
}
}
?>