You are here

function invite_sort_by_status in Invite 7.2

Comparison function callback to sort invites by status.

Parameters

$a: The first item to compare.

$b: The second item to compare.

1 string reference to 'invite_sort_by_status'
invite_admin_details in ./invite.admin.inc
Return a list of invites by a user.

File

./invite.admin.inc, line 382
Administration functions for invite module.

Code

function invite_sort_by_status($a, $b) {
  $status_a = $a->canceled ? t('Withdrawn') : ($a->joined ? t('Joined') : ($a->expiry < REQUEST_TIME ? t('Expired') : t('Pending')));
  $status_b = $b->canceled ? t('Withdrawn') : ($b->joined ? t('Joined') : ($b->expiry < REQUEST_TIME ? t('Expired') : t('Pending')));
  return $status_a < $status_b ? -1 : ($status_a > $status_b ? 1 : 0);
}