forked from science-ation/science-ation
Add school access code to email replacement tags
This commit is contained in:
parent
e6cd95ebfc
commit
54a5cc8da4
@ -310,6 +310,7 @@ case 'dialog_edit':
|
||||
<option value="REGNUM">[REGNUM]</option>
|
||||
<option value="URLMAIN">[URLMAIN]</option>
|
||||
<option value="URLLOGIN">[URLLOGIN]</option>
|
||||
<option value="ACCESSCODE" title="School Access Code">[ACCESSCODE]</option>
|
||||
</select>
|
||||
</td></tr></table>
|
||||
</td>
|
||||
@ -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'];
|
||||
|
Loading…
Reference in New Issue
Block a user