You are here

function shoutbox_edit_form in Shoutbox 6.2

Same name and namespace in other branches
  1. 5 shoutbox.module \shoutbox_edit_form()
  2. 6 shoutbox.module \shoutbox_edit_form()
  3. 7.2 shoutbox.pages.inc \shoutbox_edit_form()
  4. 7 shoutbox.pages.inc \shoutbox_edit_form()

Form for editing shouts.

Parameters

shout_id: The shout id of the shout being edited.

1 string reference to 'shoutbox_edit_form'
shoutbox_menu in ./shoutbox.module
Implementation of hook_menu().

File

./shoutbox.pages.inc, line 301
Page callbacks for the shoutbox module.

Code

function shoutbox_edit_form(&$form_state, $shout) {
  global $user;
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Author'),
    '#value' => l($shout->nick, 'user/' . $shout->uid),
  );
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Created'),
    '#value' => date('m/d/y h:i:sa', $shout->created),
  );
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Changed'),
    '#value' => date('m/d/y h:i:sa', $shout->changed),
  );
  if (_shoutbox_user_access('administer shoutbox') || _shoutbox_user_access('moderate shoutbox')) {
    $form['moderate'] = array(
      '#type' => 'radios',
      '#title' => t('Moderation status'),
      '#default_value' => $shout->moderate,
      '#options' => array(
        'published',
        'not published',
      ),
    );
  }
  if (_shoutbox_user_access('edit own shouts', $shout)) {
    $max = variable_get('shoutbox_max_length', 255);
    $form['shout'] = array(
      '#type' => variable_get('shoutbox_widget_type', 'textfield'),
      '#title' => t('Shout'),
      '#default_value' => $shout->shout,
      '#cols' => 13,
      '#required' => TRUE,
      '#rows' => 7,
      '#maxlength' => $max ? $max : NULL,
    );
    $form['shout_id'] = array(
      '#type' => 'value',
      '#value' => $shout->shout_id,
    );
  }
  $form = confirm_form($form, '', $_GET['destination'], '', t('Update'), t('Cancel'));
  return $form;
}