function _invite_user_overview in Invite 5.2
Menu callback; display an overview of sent invitations.
Parameters
$page: Which invites to list: accepted, pending, or expired.
1 call to _invite_user_overview()
- invite_user_overview in ./
invite.module - Menu callback; display an overview of sent invitations.
File
- ./
invite_admin.inc, line 338 - Administration functions for invite module.
Code
function _invite_user_overview($page = 'accepted') {
global $user;
$rows = array();
$time = time();
$profile_access = user_access('access user profiles');
$allow_delete = user_access('withdraw accepted invitations');
switch ($page) {
case 'accepted':
default:
$sql = "SELECT i.*, u.uid AS account FROM {invite} i LEFT JOIN {users} u ON u.uid = i.invitee AND u.uid <> 0 WHERE i.uid = %d AND i.joined <> 0 AND canceled = 0 ORDER BY u.uid DESC";
break;
case 'pending':
$sql = "SELECT * FROM {invite} WHERE uid = %d AND joined = 0 AND canceled = 0 AND expiry >= %d ORDER BY expiry DESC";
break;
case 'expired':
$sql = "SELECT * FROM {invite} WHERE uid = %d AND joined = 0 AND canceled = 0 AND expiry < %d ORDER BY expiry DESC";
break;
}
$result = pager_query($sql, 50, 0, NULL, $user->uid, $time);
while ($invite = db_fetch_object($result)) {
$row = array();
switch ($page) {
case 'accepted':
default:
$account_exists = !is_null($invite->account);
if ($profile_access && $account_exists) {
$row[] = l($invite->email, 'user/' . $invite->invitee, array(
'title' => t('View user profile.'),
));
}
else {
$row[] = check_plain($invite->email);
}
$row[] = $account_exists ? t('Accepted') : t('Deleted');
$row[] = $allow_delete ? l(t('withdraw'), "invite/withdraw/{$page}/{$invite->reg_code}") : '';
$row[] = '';
break;
case 'pending':
case 'expired':
$expired = $invite->expiry < $time;
$row[] = check_plain($invite->email);
$row[] = $expired ? t('Expired') : t('Pending');
$row[] = l(t('withdraw'), "invite/withdraw/{$page}/{$invite->reg_code}");
$row[] = $expired ? l(t('resend'), "invite/resend/{$invite->reg_code}") : '';
break;
}
$rows[] = $row;
}
return theme('invite_user_overview', $rows);
}