Plugin Directory

Changeset 478590


Ignore:
Timestamp:
12/21/2011 02:51:31 PM (14 years ago)
Author:
john ackers
Message:

add option to disable duplicate action check, tweak email templates

Location:
ecampaign/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ecampaign/trunk/EcampaignPetition.class.php

    r477998 r478590  
    150150    $fieldSet = $this->fieldSet;
    151151
    152     $mailer = self::getPhpMailer();
    153     $post = get_post($fieldSet->postID);
    154     $mailer->Subject = !empty($post->post_title) ? $post->post_title : "Petition signed" ;
    155     $mailer->From = $fieldSet->campaignEmail ;
    156     $mailer->FromName = get_bloginfo("name");
    157     $mailer->AddAddress($fieldSet->visitorEmail, $fieldSet->visitorName);
    158 
    159 
    160     if ($this->log->recordExists(EcampaignLog::tSign, $fieldSet->visitorEmail, '', $fieldSet->postID))
     152    if (get_option('ec_preventDuplicateActions'))
     153      if ($this->log->recordExists(EcampaignLog::tSign, $fieldSet->visitorEmail, '', $fieldSet->postID))
    161154    {
    162155      $response = array("success" => false,
     
    197190        $fieldSet->target = $recipient;
    198191    }
    199     if ($this->log->recordExists(EcampaignLog::tSend, $fieldSet->visitorEmail, $fieldSet->target, $fieldSet->postID))
     192    if (get_option('ec_preventDuplicateActions'))
     193      if ($this->log->recordExists(EcampaignLog::tSend, $fieldSet->visitorEmail, $fieldSet->target, $fieldSet->postID))
    200194    {
    201195      $response = array("success" => false,
  • ecampaign/trunk/ecampaign-admin.php

    r477786 r478590  
    8080  __("This feature prevents emails being sent to the target organisation accidentally.
    8181     Emails normally sent to campaign mailbox and friends are still sent."), '');
     82
     83  $adminFields[] = array('ec_preventDuplicateActions',
     84  __("Prevent site visitor from sending an email or signing a petition more than once.
     85  It is useful to disable when testing. "), 1);
    8286
    8387  // copies of emails are sent here
     
    140144{friendSend}');
    141145
     146  $tokenHelp = "Use %fieldname to include the value of a captured field. $fieldsHelp";
    142147
    143148  $adminFields[] = array('ec_verificationEmailSubject',
    144   __("Subject of email sent to site visitor with verification code."),
     149  __("Subject of email sent to site visitor with verification code. $tokenHelp"),
    145150  __("Verification code for ecampaign action."));
    146151
    147152
    148153  $adminFields[] = array('ec_verificationEmailBody',
    149   __("Body of email sent to site visitor with verification code."),
     154  __("Body of email sent to site visitor with verification code. You should include %code and can include %permalink
     155      (but the %permalink cannot be used to complete verification). $tokenHelp"),
    150156  __("Dear %visitorName,
    151157
    152158Thank you for verifying your email address. Please enter %code in the original web page in order to send your email.
    153159
    154 You have received this email from the website at
    155 
     160You have received this email from this webpage
     161
     162%subject at
    156163%permalink
    157164
     
    159166
    160167  $adminFields[] = array('ec_confirmationEmailSubject',
    161   __("Subject of email sent to site visitor to confirm name has been added to petition."),
    162   __("Confirmation, your name has been added to a petition"));
     168  __("Subject of email sent to site visitor to confirm name has been added to petition. $tokenHelp"),
     169  __("Your name has been added to the petition"));
    163170
    164171
    165172  $adminFields[] = array('ec_confirmationEmailBody',
    166   __("Text of email sent to site visitor to confirm name has been added to petition."),
     173  __("Text of email sent to site visitor to confirm name has been added to petition. You can include %permalink. $tokenHelp"),
    167174  __("Dear %visitorName,
    168175
     
    180187
    181188  $adminFields[] = array('ec_checkdnsrr',
    182   __("Enable checking DNS records for the domain name when checking for a valid E-mail address. "), 'yes');
     189  __("Enable checking DNS records for the domain name when checking for a valid E-mail address. "), 1);
    183190
    184191  $captchaPresent = file_exists(WP_PLUGIN_DIR . get_option('ec_captchadir') . '/securimage.php') ;
     
    196203  $adminFields[] = array('ec_subscriptionParams',
    197204  __("Parameters passed to instance of class above. ") .
    198   Ecampaign::help('#subscription'),'');
     205  Ecampaign::help('#subscription'),'optin=checkbox1');
    199206
    200207  $adminFields[] = array('ec_thirdPartyKey', __("Optional third party API Key used to lookup elected representatives. ") .
     
    247254        </td>
    248255        </tr>
    249 
    250         <?php _renderInputField($prompt, $default, 'ec_campaignEmail') ?>
    251 
    252         <?php _renderDualTextArea($prompt, $default, 'ec_layout', 26, 4) ?>
    253         <?php _renderDualTextArea($prompt, $default, 'ec_petitionLayout', 20, 4) ?>
    254         <?php _renderDualTextArea($prompt, $default, 'ec_friendsLayout', 6, 2) ?>
    255 
    256         <?php _renderDualTextArea($prompt, $default, 'ec_verificationEmailSubject', 1) ?>
    257         <?php _renderDualTextArea($prompt, $default, 'ec_verificationEmailBody', 4) ?>
    258 
    259         <?php _renderDualTextArea($prompt, $default, 'ec_confirmationEmailSubject', 1) ?>
    260         <?php _renderDualTextArea($prompt, $default, 'ec_confirmationEmailBody', 4) ?>
    261 
    262         <?php _renderInputField($prompt, $default, 'ec_mailer') ?>
    263 
    264         <tr valign="top">
    265         <th scope="row"><?php echo $prompt["ec_checkdnsrr"] ?> </th>
    266         <td><input type="checkbox" name="ec_checkdnsrr" value=1 <?php checked(get_option('ec_checkdnsrr'), 1); ?> /></td>
    267         </tr>
    268 
    269         <?php _renderInputField($prompt, $default, 'ec_captchadir') ?>
    270 
    271256        <?php
     257        _renderCheckbox($prompt, $default, 'ec_preventDuplicateActions');
     258
     259        _renderInputField($prompt, $default, 'ec_campaignEmail');
     260
     261        _renderDualTextArea($prompt, $default, 'ec_layout', 26, 4);
     262        _renderDualTextArea($prompt, $default, 'ec_petitionLayout', 20, 4);
     263        _renderDualTextArea($prompt, $default, 'ec_friendsLayout', 6, 2);
     264
     265        _renderDualTextArea($prompt, $default, 'ec_verificationEmailSubject', 1);
     266        _renderDualTextArea($prompt, $default, 'ec_verificationEmailBody', 6);
     267
     268        _renderDualTextArea($prompt, $default, 'ec_confirmationEmailSubject', 1);
     269        _renderDualTextArea($prompt, $default, 'ec_confirmationEmailBody', 6);
     270
     271        _renderInputField($prompt, $default, 'ec_mailer');
     272        _renderCheckbox($prompt, $default, 'ec_checkdnsrr');
     273
     274        _renderInputField($prompt, $default, 'ec_captchadir');
    272275
    273276        $listClassPath = get_option('ec_subscriptionClass');
     
    320323  <tr valign="top">
    321324  <th scope="row"><?php echo $prompt[$tname] ?> </th>
    322   <td><input type="text" name="<?php echo $tname?>" size='35' value="<?php echo get_option($tname); ?>" />
     325  <td><input type="text" name="<?php echo $tname?>" size='35' value="<?php echo get_option($tname,$default[$tname]); ?>" />
    323326  <?php echo $msg ?></td>
    324327  </tr>
     
    326329}
    327330
    328 
     331function _renderCheckbox($prompt, $default, $tname)
     332{
     333  ?>
     334  <tr valign="top">
     335  <th scope="row"><?php echo $prompt[$tname] ?> </th>
     336  <td><input type="checkbox" name="<?php echo $tname?>" value="1" <?php checked(get_option($tname,$default[$tname]), 1); ?> /></td>
     337  </tr>
     338  <?php
     339}
    329340
    330341function _renderDualTextArea($prompt, $default, $tname, $rows, $other="")
     
    337348  <tr valign="top">
    338349  <td>default:<br/><textarea name="<?php echo $tname?>-d" rows=<?php echo "'$rows'" ?> cols='40' readonly='readonly'><?php echo  $default[$tname]; ?></textarea></td>
    339   <td>current:<br/><textarea name="<?php echo $tname?>" rows=<?php echo "'$rows'" ?> cols='40'><?php echo get_option($tname); ?></textarea>
     350  <td>current:<br/><textarea name="<?php echo $tname?>" rows=<?php echo "'$rows'" ?> cols='40'><?php echo get_option($tname, $default[$tname]); ?></textarea>
    340351  <?php echo is_numeric($other) ? _analyzeTemplate(get_option($tname), $other) : $other ?></td>
    341352  </tr>
Note: See TracChangeset for help on using the changeset viewer.