From a5eeefa195ae6cc02be6e42c83a98d28ee3b317b Mon Sep 17 00:00:00 2001 From: james Date: Thu, 3 Mar 2011 05:03:44 +0000 Subject: [PATCH] Dont display anything for volunteer registration if its complete disabled Tweak setting school id when inviting participants when an account is both a teacher AND an admin (still need to set the school!) Disable registration_list for now, so Alison doesnt try it and see it broken and get frustrated --- admin/registration_list.php | 6 +++++- common.inc.functions.php | 2 +- user.inc.php | 16 +++++++++++++++- user_main.php | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/admin/registration_list.php b/admin/registration_list.php index b903db0..f8975c8 100644 --- a/admin/registration_list.php +++ b/admin/registration_list.php @@ -307,7 +307,11 @@ $(document).ready(function() { }); - +THIS PAGE IS NOT YET UPDATED TO THE NEW SYSTEM. PLEASE DO NOT USE IT +
diff --git a/common.inc.functions.php b/common.inc.functions.php index 9574dd0..ace4f98 100644 --- a/common.inc.functions.php +++ b/common.inc.functions.php @@ -474,7 +474,7 @@ function output_page_text($textname) { $r=mysql_fetch_object($q); else { //not defined, lets grab the default text - $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND year='-1' AND lang='".$config['default_language']."'"); + $q=mysql_query("SELECT * FROM pagetext WHERE textname='$textname' AND (year='-1' OR conferences_id='-1') AND lang='".$config['default_language']."'"); $r=mysql_fetch_object($q); } diff --git a/user.inc.php b/user.inc.php index 54bac2c..91a9f50 100644 --- a/user.inc.php +++ b/user.inc.php @@ -1328,6 +1328,8 @@ function api_user_auth_required($all_required = array(), $one_required = array() function user_volunteer_registration_status() { global $config; + if($config['volunteer_enable']=="no") + return "closed"; // $now = date('Y-m-d H:i:s'); // if($now < $config['dates']['judgeregopen']) return "notopenyet"; // if($now > $config['dates']['judgeregclose']) return "closed"; @@ -1689,10 +1691,22 @@ function user_invite($username, $password, $email, $roles_id){ if($myRole == 'teacher'){ // we already know that this is a teacher inviting a student $testquery = mysql_fetch_assoc(mysql_query("SELECT schools_id FROM users WHERE id = {$newUser['id']}")); - if(!(is_array($testquery) && $testquery['schools_id'] == $u['schools_id'])){ + //if they dont have a schools_id, set it to be that of the teacher + if(!$testquery['schools_id']) { + mysql_query("UPDATE users SET schools_id = {$u['schools_id']} WHERE id = " . $newUser['id']); + } + else if($testquery['schools_id']==$u['schools_id']) { + //they already match, do nothing + } + else { + //they dont match, crappy buzz, you cant just take them over, sorry $returnval = 'This user is not a member of your school'; } } + else if($myRole=='admin') { + //well, we still need to set the school, but we dont need all the checks that a teacher would + mysql_query("UPDATE users SET schools_id = {$u['schools_id']} WHERE id = " . $newUser['id']); + } } } else { diff --git a/user_main.php b/user_main.php index 33fa61c..c40bc38 100644 --- a/user_main.php +++ b/user_main.php @@ -299,6 +299,7 @@ function draw_signup_form($type){ echo "\"$reg_mode\" registration is not yet handled"; break; case 'invite': + echo i18n("Registration is by invite only"); output_page_text("register_{$type}_invite"); break; default: