From 5499086ea010dcdb9ee774a38aa62344392a5512 Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Mon, 12 May 2014 15:30:32 +0200 Subject: [PATCH] Document expires field --- snapporder/lib/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snapporder/lib/functions.php b/snapporder/lib/functions.php index 4a53434..f470116 100644 --- a/snapporder/lib/functions.php +++ b/snapporder/lib/functions.php @@ -11,6 +11,12 @@ function set_response_code($code) { function get_user($user_id) { global $conn; + /* Note: Field 'expires' can have the following meanings: + * - 0000-00-00 (default): No membership (never has) + * - a date < NOW(): Expired membership + * - a date >= NOW(): Valid membership + * - NULL: Lifelong membership + */ $cols = array('id', 'firstname', 'lastname', 'email', 'expires', 'cardno'); $sql = "SELECT ".implode($cols, ",").",GROUP_CONCAT(group_id) AS group_ids,expires > NOW() OR expires IS NULL AS is_member FROM din_user AS u, din_usergrouprelationship AS ug WHERE u.id=$user_id AND u.id=ug.user_id GROUP BY user_id"; $res = $conn->query($sql);