Skip to content

Commit

Permalink
Add Function to get details about the link between user and party.
Browse files Browse the repository at this point in the history
E.g. what type of price was chosen, if it was already paid and the dates for all actions (so everything contained in party_user ;))
  • Loading branch information
M4LuZ committed Apr 16, 2017
1 parent b7a43d8 commit 9f4be4c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/party/class_party.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function UpdatePartyArray(){
$_SESSION['party_info']['s_startdate'] = $row['sstartdate'];
$_SESSION['party_info']['s_enddate'] = $row['senddate'];
$_SESSION['party_info']['max_guest'] = $row['max_guest'];
}
}
}
}

function get_party_id(){
Expand Down Expand Up @@ -672,5 +672,17 @@ function get_next_party(){
return false;
}
}

/*
* Get details about this users participation at the party.
* Most prominently the name and price of the entrance ticket
*/
public function GetUserEntranceData($party_id= NULL, $user_id = NULL){
global $db, $auth;
if ($user_id === NULL) $user_id = $auth['userid']; //fill from auth, if not given
if ($party_id === NULL) $party_id = $_SESSION['party_id'];
$data= $db->qry_first("SELECT * FROM %prefix%party_user AS pu LEFT JOIN %prefix%party_prices AS price ON price.price_id=pu.price_id WHERE user_id=%int% and pu.party_id=%int%", $auth['userid'], $party_id);
return $data;
}
}
?>

0 comments on commit 9f4be4c

Please sign in to comment.