function _ad_actions_email_ad_form in Advertisement 6.3
Same name and namespace in other branches
- 6.2 actions/ad_actions.module \_ad_actions_email_ad_form()
- 7 actions/ad_actions.module \_ad_actions_email_ad_form()
A helper function for building ad action forms.
2 calls to _ad_actions_email_ad_form()
- ad_actions_send_email_action_after_form in actions/
ad_actions.module - Return a form definition so the advanced email action can be configured.
- ad_actions_send_email_action_before_form in actions/
ad_actions.module - Return a form definition so the advanced email action can be configured.
File
- actions/
ad_actions.module, line 371 - Enable ad triggers and actions.
Code
function _ad_actions_email_ad_form($context, $options, $key, $default = 0) {
$form = array();
$form[$key] = array(
'#type' => 'select',
'#title' => t('When to send'),
'#options' => $options,
'#description' => t('Specify when you would like the email sent. <em>Sending your email any time other than immediately requires cron</em>. Only one delayed email will be generated per advertisement per recipient per configured period even if the trigger event happens multiple times during the delay period.'),
'#default_value' => isset($context[$key]) ? $context[$key] : $default,
);
if (db_table_exists('profile_fields')) {
$field = '';
$result = db_query('SELECT category, name, title FROM {profile_fields}');
$first = TRUE;
while ($row = db_fetch_object($result)) {
if ($first) {
$fields = array(
'-1' => '- ' . t('select a profile field') . ' -',
);
$first = FALSE;
}
$fields[$row->category][$row->name] = $row->title . ' (' . $row->name . ')';
}
if (!empty($fields)) {
$form['disable_notifications'] = array(
'#type' => 'select',
'#title' => t('Profile field used to disable notifications'),
'#options' => $fields,
'#default_value' => isset($context['disable_notifications']) ? $context['disable_notifications'] : -1,
'#description' => t("Optionally select a profile field which can be used to disable notifications on a per-user basis for this action. If a user assigns a non-empty value or 0 value to this field, notification emails will be disabled. It is recommended that you assign a checkbox field that when checked will disable all notifications generated by this action to the recipient. Notifications can only be disabled when they are sent to email addresses associated with users on your website."),
);
}
}
return $form;
}