function _agreement_status in Agreement 6
Same name and namespace in other branches
- 6.2 agreement.module \_agreement_status()
- 7.2 agreement.module \_agreement_status()
Internal function to get the user's "agreement status".
Parameters
object $uid[optional] - UID for which the status should be checked.: Defaults to current user.
Return value
TRUE if agreement found in db.
2 calls to _agreement_status()
- agreement_init in ./
agreement.module - Implementation of hook_init().
- agreement_page in ./
agreement.module - Callback for agreement URL
File
- ./
agreement.module, line 451 - agreement.module - Agreement module code
Code
function _agreement_status($uid = NULL) {
// If the UID is not specified, use the current user.
if (empty($uid)) {
global $user;
$uid = $user->uid;
}
$frequency = check_plain(variable_get('agreement_frequency', '0'));
if ($frequency == '1') {
$query = "SELECT agreed FROM {agreement} WHERE uid='%d' and sid='%s'";
$result = db_query_range($query, array(
$uid,
session_id(),
), 0, 1);
}
else {
$query = "SELECT agreed FROM {agreement} WHERE uid='%d'";
$result = db_query_range($query, $uid, 0, 1);
}
if (db_fetch_array($result)) {
return TRUE;
}
else {
return FALSE;
}
}