Fix invitation emails

This commit is contained in:
james 2011-01-28 20:02:21 +00:00
parent ceb55a49a6
commit 8714fe7a1d

View File

@ -114,6 +114,15 @@ function account_load($id)
return $a; return $a;
} }
function account_get_password($id) {
$id=intval($id);
$q=mysql_query("SELECT password FROM accounts WHERE id='$id'");
$r=mysql_fetch_object($q);
return $r->password;
}
function account_load_by_username($username) function account_load_by_username($username)
{ {
$un = mysql_real_escape_string($username); $un = mysql_real_escape_string($username);
@ -187,6 +196,7 @@ function account_set_email($accounts_id,$email) {
// return true on success, false on failure // return true on success, false on failure
function account_add_role($accounts_id, $roles_id, $conferences_id, $password = null){ function account_add_role($accounts_id, $roles_id, $conferences_id, $password = null){
global $config; global $config;
global $conference;
// avoid injections // avoid injections
$accounts_id=intval($accounts_id); $accounts_id=intval($accounts_id);
@ -291,16 +301,26 @@ function account_add_role($accounts_id, $roles_id, $conferences_id, $password =
return "mysqlerror:" . mysql_error(); return "mysqlerror:" . mysql_error();
} }
$a=account_load($accounts_id);
$password=account_get_password($accounts_id);
//FIXME: this is where we should send the email //in this case, we want to send to pendingemail if thats all we have, because
/* //its possible that this is a new user that was just added and we just sent
email_send("{$type}_new_invite",$_POST['email'], //the email confirmation email as well, so on new user invitation, they will get
array("FAIRNAME"=>$config['fairname']), //the invite email as well as the email confirmation email.
array("FAIRNAME"=>$config['fairname'], if($a['email']) $e=$a['email'];
"EMAIL"=>$_POST['email'], else if($a['pendingemail']) $e=$a['pendingemail'];
"ROLE"=>type));
email_send("{$role}_new_invite",
$e,
array("FAIRNAME"=>$conference['name']),
array("FAIRNAME"=>$conference['name'],
"EMAIL"=>$e,
"USERNAME"=>$a['username'],
"PASSWORD"=>$password,
"ROLE"=>$role)
);
*/
// if we made it this far, the role was successfully added // if we made it this far, the role was successfully added
return 'ok'; return 'ok';
} }