forked from science-ation/science-ation
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:
parent
6ca366e1b8
commit
699e12523f
4
api.php
4
api.php
@ -842,7 +842,11 @@ switch($request[0]) {
|
|||||||
return(fields array)
|
return(fields array)
|
||||||
*/
|
*/
|
||||||
case 'fields':
|
case 'fields':
|
||||||
|
if(is_array($_POST['roles'])) {
|
||||||
|
$reqroles=$_POST['roles'];
|
||||||
|
} else {
|
||||||
$reqroles=json_decode($_POST['roles'],true);
|
$reqroles=json_decode($_POST['roles'],true);
|
||||||
|
}
|
||||||
if(is_array($reqroles)) {
|
if(is_array($reqroles)) {
|
||||||
for($x=0;$x<count($reqroles);$x++) {
|
for($x=0;$x<count($reqroles);$x++) {
|
||||||
if(is_numeric($reqroles[$x]))
|
if(is_numeric($reqroles[$x]))
|
||||||
|
@ -320,13 +320,16 @@ function user_get_role_fields($role){
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'participant':
|
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"){
|
if($config['participant_student_personal'] == "yes"){
|
||||||
$fields[] = 'dateofbirth';
|
$fields[] = 'dateofbirth';
|
||||||
}
|
}
|
||||||
if($config['participant_student_tshirt'] == "yes"){
|
if($config['participant_student_tshirt'] == "yes"){
|
||||||
$fields[] = 'tshirt';
|
$fields[] = 'tshirt';
|
||||||
}
|
}
|
||||||
|
if($config['participant_student_foodreq'] == "yes"){
|
||||||
|
$fields[] = 'foodreq';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'fair':
|
case 'fair':
|
||||||
$fields = array('fairs_id');
|
$fields = array('fairs_id');
|
||||||
|
Loading…
Reference in New Issue
Block a user