I simply want to access the country_id field to find out which one was selected in the list of a custom registration field. I have a jQuery function that works on other pages but I cannot find out where to locate the call to this function to get it to run with the s2Member registration page? Help if you can! I need the file name I think???
I have the following code associated with the given hook:
add_action(“ws_plugin__s2member_before_custom_field_gen”, “my_dynamic_field_options”);
function my_dynamic_field_options($vars = array()) {
$conn = null;
try {
$_field = &$vars["__refs"]["_field"];
if ($_field["id"] === "country_id") {
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
$sql = "SELECT
ISOen_name, ISO3166A2
FROM isocodevscountry
";
mysql_select_db(MYSQL_DB);
$retval = mysql_query($sql, $conn);
if (!$retval) {
die('Could not get data: ' . mysql_error());
}
$count_countries = 0;
while ($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
if ($count_countries == "0") {
$_field["options"] = "{$row['ISO3166A2']}" . "|" . "{$row['ISOen_name']}" . "|" . "default" . "n";
} else {
$_field["options"] .= "{$row['ISO3166A2']}" . "|" . "{$row['ISOen_name']}" . "n";
}
$count_countries++;
}
mysql_close($conn);
} elseif ($_field["id"] === "city_id") {
//Get selected Country
//Fill list with reference to selected country
}
} catch (Exception $ex) {
echo"Error in login to data base " & $ex;
mysql_close($conn);
}