From 54a5cc8da425821ecc760786b4eaf82c95dcad9a Mon Sep 17 00:00:00 2001 From: james Date: Wed, 5 Jan 2011 20:35:31 +0000 Subject: [PATCH] Add school access code to email replacement tags --- admin/communication.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/admin/communication.php b/admin/communication.php index 6198d88..5339053 100644 --- a/admin/communication.php +++ b/admin/communication.php @@ -310,6 +310,7 @@ case 'dialog_edit': + @@ -696,6 +697,12 @@ case "email_get_list": $urllogin = "$urlmain/login.php"; while($r=mysql_fetch_object($recipq)) { $u=user_load_by_uid($r->users_uid); + + //we only send school access codes to science heads or principals + $acq=mysql_query("SELECT accesscode FROM schools WHERE (sciencehead_uid='{$u['uid']}' OR principal_uid='{$u['uid']}) AND `year`='{$config['FAIRYEAR']}'"); + $acr=mysql_fetch_object($acq); + $accesscode=$acr->accesscode; + $replacements=array( "FAIRNAME"=>$config['fairname'], "SALUTATION"=>$u['salutation'], @@ -706,6 +713,7 @@ case "email_get_list": "ORGANIZATION"=>$u['sponsor']['organization'], "URLMAIN"=>$urlmain, "URLLOGIN"=>$urllogin, + "ACCESSCODE"=>$accesscode, ); if($u['email'] && $u['email'][0] != '*') { @@ -870,6 +878,12 @@ case "email_get_list": ); } if($u) { + + //we only send school access codes to science heads or principals + $acq=mysql_query("SELECT accesscode FROM schools WHERE (sciencehead_uid='{$u['uid']}' OR principal_uid='{$u['uid']}) AND `year`='{$config['FAIRYEAR']}'"); + $acr=mysql_fetch_object($acq); + $accesscode=$acr->accesscode; + $replacements=array( "FAIRNAME"=>$config['fairname'], "SALUTATION"=>$u['salutation'], @@ -880,6 +894,7 @@ case "email_get_list": "ORGANIZATION"=>$u['sponsor']['organization'], "URLMAIN"=>$urlmain, "URLLOGIN"=>$urllogin, + "ACCESSCODE"=>$accesscode, ); $toname=$u['name'];