You are here

function subscriptions_add_form in Subscriptions 6

Same name and namespace in other branches
  1. 5.2 subscriptions.admin.inc \subscriptions_add_form()
  2. 7 subscriptions.admin.inc \subscriptions_add_form()
  3. 2.0.x subscriptions.admin.old.php \subscriptions_add_form()

Provide the form definition for adding subscriptions via subscriptions/add/... link.

Callback of _subscriptions_menu() in subscriptions.module.

Parameters

$stype: Subscription type.

$sid: Subscription parameter (depends on type).

$author_uid: User ID for author-specific subscriptions or NULL/-1 for all authors.

See also

_subscriptions_menu()

1 string reference to 'subscriptions_add_form'
subscriptions_menu in ./subscriptions.module
Implementation of hook_menu().

File

./subscriptions.admin.inc, line 846
Subscriptions module (load-on-demand admin functions).

Code

function subscriptions_add_form(&$form_state, $stype, $sid, $author_uid = NULL) {
  global $user;
  $form['sid'] = array(
    '#type' => 'value',
    '#value' => $sid,
  );
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $user->uid,
  );
  $form['stype'] = array(
    '#type' => 'value',
    '#value' => $stype,
  );
  $form['author_uid'] = array(
    '#type' => 'value',
    '#value' => $author_uid,
  );
  $form['send_interval'] = array(
    '#title' => t('Send interval'),
    '#type' => 'select',
    '#options' => _subscriptions_send_intervals(),
    '#default_value' => _subscriptions_get_setting('send_interval', $user),
    '#access' => _subscriptions_get_setting('send_interval_visible', $user),
  );
  $form['updates'] = array(
    '#type' => 'checkbox',
    '#title' => 'On updates',
    '#default_value' => _subscriptions_get_setting('send_updates', $user),
    '#access' => _subscriptions_get_setting('send_updates_visible', $user),
  );
  $form['comments'] = array(
    '#type' => 'checkbox',
    '#title' => 'On comments',
    '#default_value' => _subscriptions_get_setting('send_comments', $user),
    '#access' => _subscriptions_get_setting('send_comments_visible', $user),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Subscribe'),
  );
  return $form;
}