forked from science-ation/science-ation
Fix all participant emails in communication module
Make queries for communications easier, all you need is a users.id queried, the system will find everything else for you Add ability to use [PASSWORD], [USERNAME], [EMAIL] (tries accounts.email first, if its not there, it uses accounts.pendingemail), in _ANY_ email. [REGNUM] also added but will obviously only work for participants Add "all" section to the tabs list for user editor, so a user without any roles can still get the basic pages like "account", "roles", and "personal info" Put count on participant invitations for teachers (and superusers) Fix a bug where changing a password for a different user didnt work (it changed YOURS!)
This commit is contained in:
parent
5147b3a62b
commit
23d8765fa6
@ -34,6 +34,13 @@ if($_POST['show_types'])
|
||||
|
||||
require_once('judges.inc.php');
|
||||
|
||||
if($_GET['action']=="join" && $_GET['accounts_id']) {
|
||||
//we're making this user join this conference
|
||||
echo "joining {$_GET['accounts_id']} with {$conference['id']}";
|
||||
$u = user_create(intval($_GET['accounts_id']), $conference['id']);
|
||||
echo happy(i18n("User joined conference"));
|
||||
}
|
||||
|
||||
send_header("Account List",
|
||||
array('Committee Main' => 'committee_main.php',
|
||||
'Administration' => 'admin/index.php')
|
||||
@ -93,17 +100,20 @@ if($_POST['show_types'])
|
||||
echo "<td>";
|
||||
$u=user_load_by_accounts_id($r['id']);
|
||||
if($u) {
|
||||
//we can edit them even if they dont have any roles, duh
|
||||
echo "<b>";
|
||||
echo "<a href=\"#\" onclick=\"return openeditor({$u['id']})\">";
|
||||
if($u['firstname'] || $u['lastname']) {
|
||||
echo $u['firstname']." ".$u['lastname'];
|
||||
}
|
||||
else {
|
||||
echo i18n("No name specified");
|
||||
}
|
||||
echo "</a>";
|
||||
echo "</b>";
|
||||
echo "<br />";
|
||||
|
||||
if(count($u['roles'])) {
|
||||
echo "<b>";
|
||||
echo "<a href=\"#\" onclick=\"return openeditor({$u['id']})\">";
|
||||
if($u['firstname'] || $u['lastname']) {
|
||||
echo $u['firstname']." ".$u['lastname'];
|
||||
}
|
||||
else {
|
||||
echo i18n("No name specified");
|
||||
}
|
||||
echo "</a>";
|
||||
echo "</b>";
|
||||
echo "<table>";
|
||||
foreach($u['roles'] AS $r=>$rd) {
|
||||
echo "<tr><td>";
|
||||
@ -121,7 +131,8 @@ if($_POST['show_types'])
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "no user record for this conference";
|
||||
echo "no user record for this conference. ";
|
||||
echo " <a href=\"account_list.php?action=join&accounts_id={$r['id']}\">click to join conference</a>";
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
@ -1,11 +1,13 @@
|
||||
<?
|
||||
$mailqueries=array(
|
||||
"myself"=>array("name"=>"Yourself (for testing)","query"=>"SELECT users.id FROM users WHERE users.id='{$_SESSION['users_id']}'"),
|
||||
|
||||
"committee_all"=>array("name"=>"Committee members (all)","query"=>
|
||||
"SELECT firstname, lastname, organization, email FROM users
|
||||
"SELECT users.id FROM users
|
||||
JOIN accounts ON users.accounts_id=accounts.id
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE roles.type = 'committee' AND users.deleted = 'no'
|
||||
GROUP BY users.id"),
|
||||
WHERE roles.type = 'committee' AND accounts.deleted = 'no' "),
|
||||
|
||||
/* The WHERE clause evaluates which rows to add to the GROUP
|
||||
BY, the HAVING clase evaluates which grouped rows show up. We
|
||||
@ -58,31 +60,67 @@
|
||||
AND user_roles.active='yes'
|
||||
ORDER BY email"),
|
||||
|
||||
"participants_complete_thisconference"=>array("name"=>"Participants complete for this conference","query"=>
|
||||
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.conferences_id='".$conference['id']."' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"),
|
||||
"participants_all_thisconference"=>array("name"=>"Participants (all) for this conference","query"=>
|
||||
"SELECT users.id
|
||||
FROM users
|
||||
JOIN user_roles ON user_roles.users_id=users.id
|
||||
JOIN roles ON user_roles.roles_id=roles.id
|
||||
WHERE users.conferences_id='{$conference['id']}'
|
||||
AND roles.type='participant'"),
|
||||
|
||||
"participants_complete_paymentpending_thisconference"=>array("name"=>"Participants complete for this conference but payment pending","query"=>
|
||||
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.conferences_id='".$conference['id']."' AND registrations.status!='complete' AND registrations.status='paymentpending' ORDER BY students.email"),
|
||||
"participants_complete_thisconference"=>array("name"=>"Participants complete/paymentpending for this conference","query"=>
|
||||
"SELECT users.id FROM users
|
||||
JOIN registrations ON users.registrations_id=registrations.id
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE roles.type = 'participant'
|
||||
AND registrations.conferences_id='".$conference['id']."'
|
||||
AND ( registrations.status='complete' OR registrations.status='paymentpending')"),
|
||||
|
||||
"participants_complete_paymentpending_thisconference"=>array("name"=>"Participants payment pending for this conference","query"=>
|
||||
"SELECT users.id FROM users
|
||||
JOIN registrations ON users.registrations_id=registrations.id
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE roles.type = 'participant'
|
||||
AND registrations.conferences_id='".$conference['id']."'
|
||||
AND registrations.status='paymentpending'"),
|
||||
|
||||
"participants_notcomplete_thisconference"=>array("name"=>"Participants not complete for this conference","query"=>
|
||||
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.conferences_id='".$conference['id']."' AND registrations.status!='complete' AND registrations.status!='new' ORDER BY students.email"),
|
||||
"SELECT users.id
|
||||
FROM users
|
||||
JOIN user_roles ON user_roles.users_id=users.id
|
||||
JOIN roles ON user_roles.roles_id=roles.id
|
||||
LEFT JOIN registrations ON users.registrations_id=registrations.id
|
||||
WHERE users.conferences_id='{$conference['id']}'
|
||||
AND roles.type='participant'
|
||||
AND (registrations.status IS NULL OR registrations.status='open' OR registrations.status='new')"),
|
||||
|
||||
|
||||
/* // FIXME - not sure if this has a sensible equivalent when dealing with "conferences" rather than fair years
|
||||
"participants_complete_lastyear"=>array("name"=>"Participants complete last year","query"=>
|
||||
"SELECT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND registrations.year='".($config['FAIRYEAR']-1)."' AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"),
|
||||
*/
|
||||
"participants_complete_allconferences"=>array("name"=>"Participants complete for all conferences","query"=>
|
||||
"SELECT DISTINCT firstname, lastname, students.email FROM students,registrations WHERE students.registrations_id=registrations.id AND ( registrations.status='complete' OR registrations.status='paymentpending') ORDER BY students.email"),
|
||||
|
||||
"SELECT users.id, users.firstname, users.lastname, accounts.email FROM users
|
||||
JOIN accounts on users.accounts_id=accounts.id
|
||||
JOIN registrations ON users.registrations_id=registrations.id
|
||||
JOIN user_roles ON user_roles.users_id = users.id
|
||||
JOIN roles ON roles.id = user_roles.roles_id
|
||||
WHERE roles.type = 'participant'
|
||||
AND (registrations.status='complete' OR registrations.status='paymentpending') ORDER BY accounts.email"),
|
||||
|
||||
*/
|
||||
"participants_cwsf_thisconference"=>array("name"=>"CWSF Winners for this conference","query"=>"
|
||||
SELECT DISTINCT students.firstname, students.lastname, students.email
|
||||
SELECT users.id
|
||||
FROM award_awards
|
||||
JOIN award_prizes ON award_prizes.award_awards_id=award_awards.id
|
||||
JOIN winners ON winners.awards_prizes_id=award_prizes.id
|
||||
JOIN projects ON winners.projects_id=projects.id
|
||||
JOIN registrations ON projects.registrations_id=registrations.id
|
||||
JOIN students ON students.registrations_id=registrations.id
|
||||
WHERE award_awards.cwsfaward='1' AND winners.conferences_id='".$conference['id']."'
|
||||
ORDER BY students.email"),
|
||||
JOIN users ON users.registrations_id=registrations.id
|
||||
WHERE award_awards.cwsfaward='1'
|
||||
AND winners.conferences_id='".$conference['id']."' "),
|
||||
|
||||
"sponsors"=>array("name"=>"Organization sponsors","query"=>
|
||||
"SELECT id, organization, email FROM sponsors WHERE email!='' ORDER BY email"),
|
||||
|
@ -803,7 +803,9 @@ case "email_get_list":
|
||||
$urllogin = "$urlmain/login.php";
|
||||
|
||||
while($r=mysql_fetch_object($recipq)) {
|
||||
if($r->uid)
|
||||
if($r->id)
|
||||
$u=user_load($r->id);
|
||||
else if($r->uid)
|
||||
$u=user_load_by_uid($r->uid);
|
||||
else if($r->users_uid)
|
||||
$u=user_load_by_uid($r->users_uid);
|
||||
@ -816,27 +818,45 @@ case "email_get_list":
|
||||
"FIRSTNAME"=>$r->firstname,
|
||||
"LASTNAME"=>$r->lastname,
|
||||
"NAME"=>$r->firstname." ".$r->lastname,
|
||||
"EMAIL"=>$r->email,
|
||||
"ORGANIZATION"=>$r->organization,
|
||||
"URLMAIN"=>$urlmain,
|
||||
"URLLOGIN"=>$urllogin,
|
||||
);
|
||||
}
|
||||
if($u) {
|
||||
$a=account_load($u['accounts_id']);
|
||||
$apassword=account_get_password($u['accounts_id']);
|
||||
if($a['email']) {
|
||||
$e=$a['email'];
|
||||
}
|
||||
else if ($a['pendingemail']) {
|
||||
$e=$a['pendingemail'];
|
||||
}
|
||||
else {
|
||||
$e="";
|
||||
}
|
||||
if($u['registrations_id']) {
|
||||
$regq=mysql_query("SELECT num FROM registrations WHERE id='{$u['registrations_id']}'");
|
||||
$regr=mysql_fetch_assoc($regq);
|
||||
}
|
||||
|
||||
$replacements=array(
|
||||
"FAIRNAME"=>$config['fairname'],
|
||||
"SALUTATION"=>$u['salutation'],
|
||||
"FIRSTNAME"=>$u['firstname'],
|
||||
"LASTNAME"=>$u['lastname'],
|
||||
"NAME"=>$u['name'],
|
||||
"EMAIL"=>$u['email'],
|
||||
"EMAIL"=>$e,
|
||||
"USERNAME"=>$a['username'],
|
||||
"PASSWORD"=>$apassword,
|
||||
"REGNUM"=>$regq['num'],
|
||||
"ORGANIZATION"=>$u['sponsor']['organization'],
|
||||
"URLMAIN"=>$urlmain,
|
||||
"URLLOGIN"=>$urllogin,
|
||||
);
|
||||
|
||||
$toname=$u['name'];
|
||||
$toemail=$u['email'];
|
||||
$toemail=$e;
|
||||
}
|
||||
|
||||
if($toemail) {
|
||||
|
@ -92,6 +92,7 @@ LRP 180 99765 5967 4 1 3/4 x 1/2 80 */
|
||||
/* FIXME: put these in a databse */
|
||||
/* All dimensions are in millimeters */
|
||||
$report_stock = array();
|
||||
|
||||
$report_stock['fullpage'] = array('name' => 'Letter 8.5 x 11 (3/4" margin)',
|
||||
'page_format' => 'LETTER',
|
||||
'page_orientation' => 'P',
|
||||
|
@ -233,10 +233,10 @@ if( ($_POST['action']=="invitenew" || $_POST['action']=="inviteexisting") && tri
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
if($_SESSION['superuser']=="yes") {
|
||||
echo "<h2>".i18n("The following participants have been invited from all school (you're a superuser!)")."</h2>\n";
|
||||
echo "<h2>".i18n("The following %1 participants have been invited from all schools (you're a superuser!)",array(mysql_num_rows($q)))."</h2>\n";
|
||||
}
|
||||
else {
|
||||
echo "<h2>".i18n("The following participants have been invited from your school")."</h2>\n";
|
||||
echo "<h2>".i18n("The following %1 participants have been invited from your school",array(mysql_num_rows($q)))."</h2>\n";
|
||||
}
|
||||
echo "<table class=\"tableview\">\n";
|
||||
echo "<thead>";
|
||||
|
@ -1181,8 +1181,7 @@ function user_create($accounts_id, $conferences_id=0)
|
||||
$q = mysql_query("SELECT id FROM users WHERE accounts_id='$accounts_id' AND conferences_id='$conferences_id'");
|
||||
echo mysql_error();
|
||||
if(mysql_num_rows($q)) {
|
||||
echo "ERROR: user_create called for a user that already exists.\n";
|
||||
exit;
|
||||
return "ERROR: user_create called for a user that already exists.\n";
|
||||
}
|
||||
|
||||
$fields = array(
|
||||
|
@ -132,7 +132,7 @@ case 'save':
|
||||
else if(account_valid_password($pass1) == false)
|
||||
error_("The password contains invalid characters or is not long enough");
|
||||
else {
|
||||
account_set_password($_SESSION['accounts_id'], $pass);
|
||||
account_set_password($accounts_id, $pass);
|
||||
unset($_SESSION['password_expired']);
|
||||
|
||||
happy_('Password has been successfully updated');
|
||||
|
@ -104,6 +104,7 @@ if(!array_key_exists($selected, $tabs)) {
|
||||
else
|
||||
$selected = '';
|
||||
}
|
||||
$types[]="all";
|
||||
|
||||
$fields = array();
|
||||
$required = array();
|
||||
|
@ -15,7 +15,7 @@ $tabs = array(
|
||||
'personal' => array(
|
||||
'label' => 'Personal',
|
||||
'name' => 'Personal Information',
|
||||
'types' => array('teacher','participant','judge','committee','volunteer','sponsor','fair','admin','config'),
|
||||
'types' => array('all'),
|
||||
'file' => 'user_personal.php',
|
||||
'status_func' => 'user_personal_info_status',
|
||||
'enabled' => true,
|
||||
@ -78,7 +78,7 @@ $tabs = array(
|
||||
'account' => array(
|
||||
'label' => 'Account/Login',
|
||||
'name' => 'Change Username/Email/Password',
|
||||
'types' => array('teacher','participant','judge','committee','volunteer','sponsor','fair'),
|
||||
'types' => array('all'),
|
||||
'file' => 'user_account.php',
|
||||
'status_func' => false,
|
||||
'enabled' => true,
|
||||
@ -86,7 +86,7 @@ $tabs = array(
|
||||
'roles' => array(
|
||||
'label' => 'Roles',
|
||||
'name' => 'Add/Remove Roles',
|
||||
'types' => array('teacher','participant','judge','committee','volunteer','sponsor','fair','admin','config'),
|
||||
'types' => array('all'),
|
||||
'file' => 'user_roles.php',
|
||||
'status_func' => false,
|
||||
'enabled' => true,
|
||||
|
@ -127,6 +127,8 @@ if(!array_key_exists($selected, $tabs)) {
|
||||
$selected = 'personal';
|
||||
}
|
||||
|
||||
$types[]="all";
|
||||
|
||||
|
||||
if($_GET['sub'] == 1) {
|
||||
$_SESSION['embed'] = true;
|
||||
|
Loading…
Reference in New Issue
Block a user