nathekame
Forum Replies Created
-
@rachelflara please find below the code i implemented in my case. i built a form that requires filling of state and Local government area(LGA) which is more like state and province in a place like america. so i create a parent dropdown with a list of all states in my country and then wrote a function in my functions.php file using a plugin called “code snippet”. and after i wrote the code and injected it with code snippet, i went over to the form in the LGA dropdown, i put getLGA in the choices callback field (please note that i wrote the function without the brackets) and under the options section you put a * sign because that portion cant be left empty. and then on the parent option section i selected state option . i hope this helps, goodluck
function getLGA() {
global $wpdb;
//get the value from the ‘parent’ field, sent via the AJAX post.
$choice = $_POST[‘parent_option’];$lgaList = array();
$results = $wpdb->get_results( $wpdb->prepare( “SELECT DISTINCT lga FROM pu_data WHERE state=%s”, $choice));
foreach ( $results as $lgas ) {
$lgaList[$lgas->lga] = $lgas->lga;
}
return $lgaList;
}
@artmerk how do you now get the value of the parent option without specifying it in the parent option field… what data will the choices callback use to perform its logic
somebody help me here i am getting frustrated with this
i am stuck right now in my project cos of this issue, i personally think this should be given to us as an option in the settings…
i also had another trouble with expanding increasing the tabs on user account page… when i implemented it with the um action hook, i realized that the new tab content comes with a button underneath… which i dont need…
i think this version 2.X.X of UM is more trouble…. im considering reverting to previous versions…