make foodreq field based on configuration

api registration/fields accepts both string (to json decode) or a post array, so the testapi page works
This commit is contained in:
james 2011-03-03 18:11:36 +00:00
parent 6ca366e1b8
commit 699e12523f
2 changed files with 9 additions and 2 deletions

View File

@ -842,7 +842,11 @@ switch($request[0]) {
return(fields array)
*/
case 'fields':
$reqroles=json_decode($_POST['roles'],true);
if(is_array($_POST['roles'])) {
$reqroles=$_POST['roles'];
} else {
$reqroles=json_decode($_POST['roles'],true);
}
if(is_array($reqroles)) {
for($x=0;$x<count($reqroles);$x++) {
if(is_numeric($reqroles[$x]))

View File

@ -320,13 +320,16 @@ function user_get_role_fields($role){
}
break;
case 'participant':
$fields = array('grade', 'schools_id', 'foodreq', 'medicalalert', 'registrations_id');
$fields = array('grade', 'schools_id', 'medicalalert', 'registrations_id');
if($config['participant_student_personal'] == "yes"){
$fields[] = 'dateofbirth';
}
if($config['participant_student_tshirt'] == "yes"){
$fields[] = 'tshirt';
}
if($config['participant_student_foodreq'] == "yes"){
$fields[] = 'foodreq';
}
break;
case 'fair':
$fields = array('fairs_id');