latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Dynamic Custom Fields Disappearing

Home Forums Community Forum Dynamic Custom Fields Disappearing

Tagged: 

This topic contains 1 reply, has 1 voice. Last updated by  Justin F. 3 years, 2 months ago.

Topic Author Topic
Posted: Thursday Oct 24th, 2013 at 9:31 am #60581
Justin F.
Username: jfuhr

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'));
		}		
	}
?>

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Friday Oct 25th, 2013 at 2:17 pm #60608
Justin F.
Username: jfuhr

Any help on this would be much appreciated. I feel like I am just missing one little detail as the Chapter data is getting into the the database but it just wipes all the other custom fields out. Thanks for you time.

Viewing 1 replies (of 1 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.