Added getRegistrationsId() function, returning the registration ID for the specified user

This commit is contained in:
jacob 2011-02-18 17:05:07 +00:00
parent 96f36d4681
commit 6519392bd5

View File

@ -655,6 +655,26 @@ function addRegistration($userId){
return $regnum;
}
// get the registration id for a specific user.
//Accepts either the user object or the user id, and returns the registration id, or NULL if none is set, error message if something's borked
function getRegistrationsId($user){
// get the user id
if(is_array($user)){
if(!array_key_exists('id', $user)) return "register_participants.inc.php::getRegistrationsId -> Invalid user object";
$uid = $user['id'];
}else{
$uid = $user;
}
// grab their registrations id
$result = mysql_fetch_assoc(mysql_query("SELECT registrations_id FROM users WHERE id = $uid"));
if(mysql_error()){
return "register_participants.inc.php::getRegistrationsId -> " . $mysql_error();
}
return $result['registrations_id'];
}
function getProject($registrations_id){
global $conference;
// FIXME - in the future, this should be able to handle a many-to-many