function invite_form_user_profile_form_alter in Invite 7.2
Implements hook_form_FORM_ID_alter().
File
- ./
invite.module, line 1696 - Allows your users to send and track invitations to join your site.
Code
function invite_form_user_profile_form_alter(&$form, &$form_state) {
$account = $form['#user'];
if (user_access('administer invitations')) {
$invite = db_select('invite', 'i')
->fields('i')
->condition('invitee', $account->uid)
->execute()
->fetchObject();
$default_value = '';
if (!empty($invite)) {
$inviter = user_load($invite->uid);
$default_value = $inviter->name;
}
$form['inviter'] = array(
'#type' => 'textfield',
'#size' => 120,
'#title' => t('Inviter'),
'#default_value' => $default_value,
'#description' => t('The username of the inviter. You can type the name or email to search.'),
'#element_validate' => array(
'invite_inviter_validate',
),
'#autocomplete_path' => 'invite/invite_user_autocomplete',
);
if (!empty($default_value)) {
$form['inviter']['#disabled'] = TRUE;
}
}
$form['#submit'][] = 'invite_user_form_submit';
}