You are here

function invite_block_form in Invite 6.2

Same name and namespace in other branches
  1. 5.2 invite.module \invite_block_form()
  2. 7.2 invite.module \invite_block_form()

Generate the invite block form.

Parameters

$remaining_invite: Number of remaining invites.

Return value

A form definition.

1 call to invite_block_form()
invite_form in ./invite.module
Generate the invite forms.

File

./invite.module, line 867
Allows your users to send and track invitations to join your site.

Code

function invite_block_form($remaining_invites) {
  global $user;
  $form['#action'] = url('invite');
  $form['invite'] = array(
    '#value' => t('Recommend @site-name to:', array(
      '@site-name' => variable_get('site_name', t('Drupal')),
    )),
  );
  $description = '';
  if ($remaining_invites != INVITE_UNLIMITED) {
    $description = format_plural($remaining_invites, '1 invite remaining', '@count invites remaining');
  }
  $form['email'] = array(
    '#type' => 'textfield',
    '#size' => 20,
    '#maxlength' => 64,
    '#description' => $description,
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send invite'),
  );
  $form['link'] = array(
    '#prefix' => '<div><small>',
    '#value' => l(t('View your invites'), "user/{$user->uid}/invites"),
    '#suffix' => '</small></div>',
    '#access' => user_access('track invitations') && $user->uid,
  );
  return $form;
}