Changeset 1062 in ExiteCMS


Ignore:
Timestamp:
11/05/07 21:46:49 (4 years ago)
Author:
hverton
Message:

Modified the newsletters module so that no newsletters are send to deactivated or suspended member accounts, or member accounts which an invalid email address. A count of invalid email addresses is shown in the progress status panel after the newsletter has been sent.

Location:
modules/common/newsletters/php-files/modules/newsletters
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/common/newsletters/php-files/modules/newsletters/locale/English.php

    r902 r1062  
    2828$locale['nl423'] = "Newsletter Copied"; 
    2929$locale['nl424'] = "A preview of the newsletter has been sent successfully to your email address."; 
     30$locale['nl425'] = "%s newsletters could not be sent due to an invalid email address."; 
    3031// Add/Edit Newsletter Form 
    3132$locale['nl430'] = "Subject:"; 
  • modules/common/newsletters/php-files/modules/newsletters/newsletters.php

    r915 r1062  
    156156 
    157157    // build the query on the user table based on the selection made 
    158     $query = "SELECT * FROM ".$db_prefix."users WHERE"; 
     158    $query = "SELECT * FROM ".$db_prefix."users WHERE user_status = 0 AND "; 
    159159    $where = ""; 
    160160    if ($send_to_myself) { 
     
    181181    $result2 = dbquery($query); 
    182182 
    183      
    184     $error = ""; $sc = 0; 
     183    // process the selected users 
     184    $error = ""; $sc = 0; $bad_email = 0; 
    185185    if (dbrows($result2) == 0) { 
    186186        $error = $locale['nl419']; 
     
    192192        $error = array(); 
    193193        while($data2 = dbarray($result2)) { 
     194 
     195            // check if this user has an invalid email address flag 
     196            if ($data2['user_bad_email'] != 0) { 
     197                // update the counter, and skip this user 
     198                $bad_email++; 
     199                continue; 
     200            } 
     201 
     202            // replace tags in the subject 
    194203            $subject = stripslashes($data['newsletter_subject']); 
    195             // replace tags in the subject 
    196204            $subject = str_replace("{:USER_NAME:}", $data2['user_name'], $subject); 
    197205 
     206            // replace tags in the body 
    198207            $content = stripslashes($data['newsletter_content']); 
    199             // replace tags in the body 
    200208            $content = str_replace("{:USER_ID:}", $data2['user_id'], $content); 
    201209            $content = str_replace("{:USER_NAME:}", $data2['user_name'], $content); 
     
    283291 
    284292    // process the error messages 
    285     $variables['message'] = "<b>"; 
     293    $variables['message'] = ""; 
    286294    if (is_array($error)) { 
    287295        if ($send_to_myself) { 
     
    300308    } else { 
    301309        $variables['message'] .= $error; 
     310    } 
     311    if ($bad_email) { 
     312        $variables['message'] .= "<br /><br />".sprintf($locale['nl425'], $bad_email); 
    302313    } 
    303314    $variables['bold'] = true; 
Note: See TracChangeset for help on using the changeset viewer.