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.

retrieving the value from drop down

Home Forums Community Forum retrieving the value from drop down

This topic contains 1 reply, has 2 voices. Last updated by  Raam Dev 4 years, 5 months ago.

Topic Author Topic
Posted: Friday Jul 27th, 2012 at 3:12 pm #20430

how can I retrieve the value of a drop down that the user chooses while registering?

I am trying to auto-populate forms on my site.

I have been able to retrieve data from a text field and populate my form with a function like this:

// populate the field with "user_title" as the population parameter with the "user_title" of the current user
function env_populate_title() {
	$s2title = get_user_field ("title");
	if ($s2title == '') { $value = populate_usermeta('user_title'); }
	else { $value = $s2title; }
	return $value;
}
add_filter('gform_field_value_user_title', 'env_populate_title' );

If I have a drop down select field with an id of country, would get_user_field(“country”) return the value for the selected option?

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Saturday Jul 28th, 2012 at 2:08 am #20489
Raam Dev
Username: Raam
Staff Member

Hi Stephanie,

Yes, I believe that should work. You can always try doing,

echo 'Country: ' . get_user_field(“country”);

to have it print out the value of that field. That way you can check what it’s pulling. Keep in mind the user must be logged in for this to work, otherwise the get_user_field() function won’t know which user it’s supposed to be getting the value from.

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.