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.

PHP/MYSQL Driven Option Fields for Profile

Home Forums Community Forum PHP/MYSQL Driven Option Fields for Profile

This topic contains 0 replies, has 1 voice. Last updated by  Kyle Henderson 4 years, 6 months ago.

Topic Author Topic
Posted: Thursday Jun 14th, 2012 at 8:35 pm #16526

Registration/Profile Fields allow you to add a field and options, but I was wondering if there was some way I can make the options dynamically driven from the database or elsewhere. An example would be something like this sudo code:

php output is:

theme’s functions.php file (or wherever makes sense) has:

function getPreferredVendorOptions()
	{
	$output = '';
	$result = mysql_query("SELECT * FROM `vendor`;") or die(mysql_error());
	while($row = mysql_fetch_array( $result ))
		{
		$output .= $row['id'].'|'.$row['name']; // option ID, Pipe, Option Text per s2 select format
		}
	echo $output;
	}

Of course let me know if there is a better way to go about doing this, but any help is appreciated!

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.