function invite_user_overview in Invite 6.2
Same name and namespace in other branches
- 5.2 invite.module \invite_user_overview()
- 7.2 invite.pages.inc \invite_user_overview()
Menu callback; display an overview of sent invitations.
Parameters
$page: Which invites to list: accepted, pending, or expired.
1 string reference to 'invite_user_overview'
- invite_menu in ./
invite.module - Implementation of hook_menu().
File
- ./
invite_admin.inc, line 350 - 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/{$invite->reg_code}", array(
'query' => drupal_get_destination(),
)) : '';
$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/{$invite->reg_code}", array(
'query' => drupal_get_destination(),
));
$row[] = $expired ? l(t('resend'), "invite/resend/{$invite->reg_code}") : '';
break;
}
$rows[] = $row;
}
return theme('invite_user_overview', $rows);
}