'checkboxes',
'#title' => t('Which node types can have invites?'),
'#description' => t('Use this to enable/disable node types that can have invites associated with them'),
'#options' => node_get_types('names'),
'#default_value' => variable_get('node_invite_node_types', array()),
'#weight' => -10,
);
$form['node_invite_default'] = array(
'#weight' => -9,
'#title' => t('Default behavior on enabled node-types'),
'#type' => 'select',
'#options' => array(
'1' => 'Enable invites',
'0' => 'Disable invites',
),
'#default_value' => variable_get('node_invite_default', NODE_INVITE_DEFAULT_FOR_ENABLED_NODES),
'#description' => t('
Enable Invites = All nodes of an enabled type will have a $node->link[\'\'] unless you un-check the "Enable invites for this node" box in the node/edit form
Disable Invites = To get an invite for a specific node, you will need to check the "Enable invites for this node" box in the node/edit form'),
);
$form['node_invite_set_email'] = array(
'#type' => 'checkbox',
'#title' => t('Allow user to set their own email and name'),
'#description' => t('Leaving this unchecked will force the user to invite from their email address and username as configured in their profile.'),
'#default_value' => variable_get('node_invite_set_email', TRUE),
);
$form['node_invite_default_from'] = array(
'#type' => 'textfield',
'#title' => t('Specify a default From address'),
'#description' => t('If this field is set then all outgoing emails will have the From address set to the given value (normally something like no-reply@example.com). The Reply To address will be set to the users specified email address. This is recommended if you find your outgoing emails are being flagged as spam due to the sender address domain differing from the domain of the outgoing SMTP server.'),
'#default_value' => variable_get('node_invite_default_from', ''),
);
$form['node_invite_hash_urls'] = array(
'#type' => 'checkbox',
'#title' => t('Use private URLs'),
'#description' => t('Check this to enable hash\'d URLs that will make guessing another guests RSVP page impossible.'),
'#default_value' => variable_get('node_invite_hash_urls', FALSE),
);
// @TODO: If this setting is changed then we need to clear the menu cache.
$form['node_invite_display'] = array(
'#type' => 'select',
'#title' => t('How would you like the invite form to be displayed?'),
'#options' => array(
'link' => t('Link in the links area of a node'),
'tab' => t('"Invite people" tab on the full node view'),
'form' => t('Inline form on the full node view'),
),
'#default_value' => variable_get('node_invite_display', 'link'),
);
$form['node_invite_user_invite'] = array(
'#type' => 'fieldset',
'#title' => t('User Invite Options'),
'#description' => t('Setup the user/email inviting options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['node_invite_user_invite']['node_invite_user_limit'] = array(
'#type' => 'textfield',
'#title' => t('Max users to appear in the user autocomplete dropdown.'),
'#default_value' => variable_get('node_invite_user_limit', 10),
'#size' => 6,
);
$form['node_invite_user_invite']['node_invite_disable_email'] = array(
'#type' => 'checkbox',
'#title' => t('Disable the email addresses invite field'),
'#description' => t('Selecting this will mean users can only invite members of the site to nodes.'),
'#default_value' => variable_get('node_invite_disable_email', 0),
);
$form['node_invite_user_invite']['node_invite_disable_users'] = array(
'#type' => 'checkbox',
'#title' => t('Disable the user invite field'),
'#description' => t('Selecting this will mean users can only invite members by email address.'),
'#default_value' => variable_get('node_invite_disable_users', 0),
);
$form['node_invite_user_invite']['node_invite_sync_users'] = array(
'#type' => 'checkbox',
'#title' => t('Keep user emails in sync with invitations'),
'#description' => t('This will alter the invitation "sent" email address if a user changes their account email address to make sure they always stay in sync.'),
'#default_value' => variable_get('node_invite_sync_users', 0),
);
if (module_exists('userreference')) {
$form['node_invite_user_invite']['node_invite_userreference'] = array(
'#type' => 'checkbox',
'#title' => t('Enable user reference selection'),
'#description' => t('This will use the user reference field method of filtering users instead of the built in method which selects from all users in the system.'),
'#default_value' => variable_get('node_invite_userreference', 0),
);
$settings = array(
'referenceable_roles' => variable_get('node_invite_referenceable_roles', array()),
'referenceable_status' => variable_get('node_invite_referenceable_status', ''),
'advanced_view' => variable_get('node_invite_advanced_view', '--'),
'advanced_view_args' => variable_get('node_invite_advanced_view_args', ''),
);
// Copy the userreference node form settings into the node invite admin page.
if ($ur_form = userreference_field_settings('form', $settings)) {
$form['node_invite_user_invite']['node_invite_referenceable_roles'] = $ur_form['referenceable_roles'];
unset($ur_form['referenceable_status']['#default_value']);
$form['node_invite_user_invite']['node_invite_referenceable_status'] = $ur_form['referenceable_status'];
$form['node_invite_user_invite']['advanced'] = $ur_form['advanced'];
$form['node_invite_user_invite']['advanced']['node_invite_advanced_view'] = $ur_form['advanced']['advanced_view'];
$form['node_invite_user_invite']['advanced']['node_invite_advanced_view_args'] = $ur_form['advanced']['advanced_view_args'];
unset($form['node_invite_user_invite']['advanced']['advanced_view']);
unset($form['node_invite_user_invite']['advanced']['advanced_view_args']);
}
}
else {
$form['node_invite_user_invite']['userreference_help'] = array(
'#value' => '
' . t('Enable the cck userreference field and you can use identical options to filter user selection for invitations, including role selection or views.') . '
', ); } $form['node_invite_rsvp_page'] = array( '#type' => 'fieldset', '#title' => t('RSVP Page'), '#description' => t('Users who receive an invite, will be directed to a page asking them to accept the invite. The parts of that page are configurable here.'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['node_invite_rsvp_page']['node_invite_rsvp_display'] = array( '#type' => 'select', '#title' => t('How would you like the RSVP form to be displayed?'), '#options' => array( 'link' => t('Link in the links area of a node'), 'form' => t('Inline form on the full node view'), ), '#default_value' => variable_get('node_invite_rsvp_display', 'link'), '#description' => t('This will only apply to nodes set up as "open invite"'), ); $form['node_invite_rsvp_page']['node_invite_rsvp_show_comments'] = array( '#type' => 'select', '#options' => array( '1' => 'Yes', '0' => 'No', ), '#default_value' => variable_get('node_invite_rsvp_show_comments', '0'), '#title' => t('Allow invitees to leave comments?'), '#description' => t('This causes a text-area to show up on the RSVP form.'), ); $form['node_invite_rsvp_page']['node_invite_rsvp_email'] = array( '#type' => 'select', '#title' => t('Force user to re-enter their email?'), '#description' => t('Optional security measure'), '#options' => array( '1' => 'Yes', '0' => 'No', ), '#default_value' => variable_get('node_invite_rsvp_email', '0'), ); $form['node_invite_rsvp_page']['node_invite_rsvp_page_submit_pretext'] = array( '#type' => 'textarea', '#title' => t('Text to display before submit buttons'), '#default_value' => variable_get('node_invite_rsvp_page_submit_pretext', NODE_INVITE_RSVP_PAGE_SUBMIT_PRETEXT), '#description' => t('Tokens and html accepted.'), ); $form['node_invite_rsvp_page']['node_invite_rsvp_page_title'] = array( '#type' => 'textfield', '#title' => t('Page Title'), '#default_value' => variable_get('node_invite_rsvp_page_title', NODE_INVITE_RSVP_PAGE_TITLE), '#description' => t('The subject is token-enabled. Please use the list below for replacement patterns.'), ); $form['node_invite_rsvp_page']['node_invite_rsvp_page_intro'] = array( '#type' => 'textarea', '#title' => t('Page Intro Text'), '#default_value' => variable_get('node_invite_rsvp_page_intro', NODE_INVITE_RSVP_PAGE_INTRO), '#description' => t('This block of text will lead off the form. The subject is token-enabled. Please use the list below for replacement patterns.'), ); $form['node_invite_message'] = array( '#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => TRUE, '#title' => t('Invite Message'), ); $form['node_invite_message']['node_invite_message_default'] = array( '#type' => 'textarea', '#title' => t('E-Mail Sent to Invitees'), '#description' => t('The email we send is token-enabled. Please use the list below for replacement patterns. This email will be HTML formatted if you are using the HTMLMail module.'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#default_value' => variable_get('node_invite_message_default', NODE_INVITE_MESSAGE_DEFAULT), '#weight' => 0, ); $form['node_invite_message']['node_invite_subject_default'] = array( '#type' => 'textfield', '#title' => t('Subject for emails'), '#description' => t('The subject is token-enabled. Please use the list below for replacement patterns.'), '#default_value' => variable_get('node_invite_subject_default', NODE_INVITE_SUBJECT_DEFAULT), '#weight' => -1, ); $form['node_invite_tokens'] = array( '#type' => 'fieldset', '#title' => t('Token Help'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => "Not all tokens will be available. The following lists all tokens known to Drupal. The list of available tokens will depend on the type of node to which you are inviting people.
" . theme('token_help', 'all'), ); return system_settings_form($form); } function node_invite_admin_settings_form_validate($form, &$form_state) { // Can't disable both the email and user fields at the same time if ($form_state['values']['node_invite_disable_email'] && $form_state['values']['node_invite_disable_users']) { form_set_error('node_invite_disable_email', t('You cannot disable both the email and user invite fields or your users will not be able to invite anyone.')); } } function node_invite_notifications_form() { $form['node_invite_intro'] = array( '#value' => 'This form allows you to manage notifications set out by the node_invite module
' ); $form['node_invite_nots_rsvps'] = array( '#type' => 'checkboxes', '#title' => t('Who should we notify when someone RSVPs?'), '#options' => array( 'invitee' => 'Invitee: Upon selection of any option, the invitee should receive an email confirming their selection (regardless of Yes/No/Maybe)', 'inviter' => 'Inviter: The person who sent the original invite should receive an email notifying them that someone answer their invite (regardless of Yes/No/Maybe)', ), '#default_value' => variable_get('node_invite_nots_rsvps', array('inviter', 'invitee')), ); $form['node_invite_nots_admin'] = array( '#type' => 'radios', '#title' => t('When should we notify the site admin of an invite response?'), '#options' => array( 'site_admin_never' => t('Never notify the site admin of an invite response.'), 'site_admin_yes' => t('Site Admin User should receive an email whenever someone ACCEPTS an invite'), 'site_admin_all' => t('Site Admin User should receive an email whenever someone responds (with any answer) to an invite'), ), '#default_value' => variable_get('node_invite_nots_admin', 'site_admin_all'), ); $form['node_invite_nots_sep'] = array( '#value' => '' . t("This form allows you to manage those invites you've sent out.") . '
'; $output .= node_invite_list_invites(); return $output; } /** * Revoke the invite. */ function node_invite_revoke($form_state, $invite) { // ask for confirmation that they really want to revoke the invite. $form['invite'] = array( '#type' => 'value', '#value' => $invite, ); $form['#redirect'] = $_GET['destination']; return confirm_form($form, 'Are you sure you wish to revoke this invite?', $_GET['destination'] ); } function node_invite_revoke_submit($form, &$form_state) { $invite = $form_state['values']['invite']; node_invite_save($invite, array('status' => NODE_INVITE_REVOKED)); } function node_invite_reinstate($invite) { node_invite_save($invite, array('status' => NODE_INVITE_NEW)); drupal_goto($_GET['destination']); } /** * Resend the invite. */ function node_invite_resend($form_state, $invite) { module_load_include('inc', 'node_invite', 'node_invite.send'); // Setup the node send form $form = node_invite_send($form_state, node_load($invite->nid)); $form['your_name']['#default_value'] = $invite->inviter_custom_name ? $invite->inviter_custom_name : $invite->name; $form['your_email']['#default_value'] = $invite->inviter_custom_email ? $invite->inviter_custom_email : $invite->mail; $form['personal_message']['message']['#default_value'] = $invite->personal_message; if ($invite->uid_invitee && !variable_get('node_invite_disable_users', FALSE)) { $account = user_load($invite->uid_invitee); $form['users_markup'] = $form['users']; $form['users_markup']['#type'] = 'markup'; $output = '