Changeset 1850 in ExiteCMS for trunk/forum/viewthread.php


Ignore:
Timestamp:
10/14/08 19:53:46 (4 years ago)
Author:
hverton
Message:

fixed not sending notify emails on quick replies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/viewthread.php

    r1802 r1850  
    176176                $newpost_id = mysql_insert_id(); 
    177177                $result = dbquery("UPDATE ".$db_prefix."users SET user_posts=user_posts+1 WHERE user_id='".$userdata['user_id']."'"); 
     178                // check if we need to notify people 
     179                if ($settings['thread_notify']) { 
     180                    $result = dbquery( 
     181                        "SELECT tn.*, tu.user_id,user_name,user_email FROM ".$db_prefix."thread_notify tn 
     182                        LEFT JOIN ".$db_prefix."users tu ON tn.notify_user=tu.user_id 
     183                        WHERE thread_id='$thread_id' AND notify_user!='".$userdata['user_id']."' AND notify_status='1' 
     184                    "); 
     185                    if (dbrows($result)) { 
     186                        require_once PATH_INCLUDES."sendmail_include.php"; 
     187                        $data2 = dbarray(dbquery("SELECT thread_subject FROM ".$db_prefix."threads WHERE thread_id='$thread_id'")); 
     188                        $link = $settings['siteurl']."forum/viewthread.php?forum_id=$forum_id&thread_id=$thread_id&pid=$newpost_id#post_$newpost_id"; 
     189                        while ($data = dbarray($result)) { 
     190                            $message_el1 = array("{USERNAME}", "{THREAD_SUBJECT}", "{THREAD_URL}", "{SITE_NAME}", "{SITE_WEBMASTER}"); 
     191                            $message_el2 = array($data['user_name'], $data2['thread_subject'], $link, html_entity_decode($settings['sitename']), html_entity_decode($settings['siteusername'])); 
     192                            $message_subject = str_replace("{THREAD_SUBJECT}", $data2['thread_subject'], $locale['550']); 
     193                            $message_content = str_replace($message_el1, $message_el2, $locale['551']); 
     194                            $err = sendemail($data['user_name'],$data['user_email'],$settings['siteusername'],($settings['newsletter_email'] != "" ? $settings['newsletter_email'] : $settings['siteemail']),$message_subject,$message_content); 
     195                        } 
     196                        $result = dbquery("UPDATE ".$db_prefix."thread_notify SET notify_status='0' WHERE thread_id='$thread_id' AND notify_user != '".$userdata['user_id']."'"); 
     197                    } 
     198                } 
    178199                redirect("post.php?action=quickreply&forum_id=$forum_id&thread_id=$thread_id&post_id=$newpost_id&errorcode=0"); 
    179200            } 
Note: See TracChangeset for help on using the changeset viewer.