Index: invite.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/invite/invite.module,v retrieving revision 1.9.2.4 diff -u -p -r1.9.2.4 invite.module --- invite.module 19 Nov 2006 10:26:53 -0000 1.9.2.4 +++ invite.module 28 Nov 2006 00:49:41 -0000 @@ -1,4 +1,5 @@ $multiple = FALSE, '#required' => $required = TRUE, ); + $form['user_settings']['invite_allow_join_delete'] = array( + '#type' => 'checkbox', + '#title' => t('Allow deletion of joined users'), + '#default_value' => variable_get('invite_allow_join_delete', 0), + '#description' => t('After an invitee has registered, this option allows a site administrator the option to delete the invitations marked as joined. Useful for users who delete their account to be re-invited or for users who change their email address') + ); $form['user_roles'] = array( '#type' => 'fieldset', @@ -267,7 +274,7 @@ function invite_form_alter($form_id, &$f if ((!$user_admin) && $invite_only) { if (!$valid_invite) { // Redirect to the standard login form if in invite only mode and a valid invite is not present - drupal_set_message('Sorry, new user registration by invite only.'); + drupal_set_message(t('Sorry, new user registration by invite only.')); drupal_goto('user/'); } @@ -306,7 +313,7 @@ function invite_register_submit($form_id return user_register_submit($form_id, $form_values); } else { // Do some watchdog stuff - drupal_set_message('You have not been invited to join this site'); + drupal_set_message(t('You have not been invited to join this site.')); watchdog('invite', 'Uninvited user registration attempt', $link = NULL); } } @@ -377,12 +384,30 @@ function invite_page(){ $inc = 0; $result = db_query("SELECT * from {invite} WHERE uid = %d",$user->uid); while ($invite = db_fetch_object($result)){ - $items[] = array($invite->email, (($invite->expiry + (variable_get('invite_expiry', '30')* 24 * 60 * 60))< time()) ? "Expired" :($invite->timestamp ? t('Joined') : t('Pending')),$invite->timestamp ? "delete" : l("delete",'invite/delete/'.urlencode($invite->email))); + $expiry = $invite->expiry + (variable_get('invite_expiry', '30') * 24 * 60 * 60); + if (!$invite->timestamp) { + $email_cell = $invite->email; + if ($expiry < time()) { + $status_cell = t('Expired'); + $action_cell = l("Delete invitation",'invite/delete/'.urlencode($invite->email)); + } + else { + $status_cell = t('Pending'); + $action_cell = l("Delete invitation",'invite/delete/'.urlencode($invite->email)); + } + } + else { + $account = user_load(array('mail' => $invite->email)); + $email_cell = isset($account->uid) ? l($invite->email, 'user/'.$account->uid) : "{$invite->email}"; + $status_cell = t('Joined'); + $action_cell = (variable_get('invite_allow_join_delete', 0) && isset($account->uid)) ? l("Delete invitation",'invite/delete/'.urlencode($invite->email)) : ' '; + } + $items[] = array($email_cell, $status_cell, $action_cell); $inc++; } if (count($items) > 0) { - $headers = array(t('Email'), t('Status'), ''); + $headers = array(t('Email'), t('Status'), ' '); $table = theme('table', $headers, $items, array('id' => 'invite_table')); } else { @@ -430,7 +455,7 @@ function invite_page(){ '#value' => t('Submit'), ); } else { - drupal_set_message(t('Maximum number (%max) of invitations reached', array('%max' => $maximum_invites))); + drupal_set_message(t('Maximum number (%max) of invitations reached.', array('%max' => $maximum_invites))); } $output .= drupal_get_form('invite_form', $form); @@ -461,7 +486,7 @@ function invite_delete($email) { $email = urldecode($email); if ($email){ db_query("DELETE from {invite} WHERE email = '%s'",$email); - drupal_set_message("Invitation to $email has been deleted"); + drupal_set_message(t('Invitation to %email has been deleted.', array('%email' => $email))); $args = array('email' => $email); module_invoke_all('invite', 'cancel', $args); drupal_goto('invite'); @@ -481,7 +506,7 @@ function _invite_check_invited($email, $ $result = db_query('SELECT * FROM {invite}'); while ($t = db_fetch_object($result)) { if ($t->email == $email){ - drupal_set_message("The user you are trying to invite has already been invited"); + drupal_set_message(t('The user you are trying to invite has already been invited')); $already_invited = 0; } } @@ -492,7 +517,7 @@ function _invite_check_invited($email, $ $result = db_query("SELECT COUNT(*) from {invite} WHERE uid = %d", $uid); if (db_result($result) >= $maximum_invites){ - drupal_set_message("You have exceeded your allowed invitations"); + drupal_set_message(t('You have exceeded your allowed invitations')); $already_invited = 0; } } @@ -626,7 +651,7 @@ _MAIL_; function _invite_unblock($uid) { - if (ctype_digit($uid)) { + if (is_numeric($uid)) { db_query("UPDATE {users} SET status = 1 WHERE uid = %d", $uid); return TRUE; }