Author Topic: [Mod] Send email when an answer to your Comments or Image  (Read 29056 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
[Mod] Send email when an answer to your Comments or Image
« on: July 17, 2011, 08:18:01 PM »
Hi!

For English Please use Google Translate.

Mit dieser Modification werden Emails versendet, bei einer Antwort zu deinen Kommentar oder deinen Bild.

Erforderlich, aus diesen Mod:[MOD] Sende Emails als HTML
Schritt 1.) aus der "html_email_files.zip" alle Dateien im Ordner "/includes/" und "lang/yourLang/email/images/"
Schritt 7.) und 7.1)

Neue Dateien (Attachment):
lang/deutsch/email/comment_answer.html
lang/deutsch/email/comment_answer_html.html
lang/deutsch/email/comment_image.html
lang/deutsch/email/comment_image_html.html

zu Modifizierende Dateien:
include/db_field_definitions.php
lang/deutsch/main.php
root/details.php
templates/yourTemplate/member_editprofile.php

1.) Download die Datei "install.zip" (Attachment) und kopiere die Dateien in den entsprechenden Ordner in deiner Galerie.

2.) Kopiere die "install_email.php" in deinen root und führe sie aus.

3.) suche in der db_field_definitions.php "?>" und füge davor ein:

$additional_user_fields
['user_comment_image'] = array($lang['comment_image'], "radio"0);
$additional_user_fields['user_comment_answer'] = array($lang['comment_answer'], "radio"0);


4.) suche in der main.php "?>" und füge davor ein:

$lang
['user_comment_image'] = "Neuer Kommentar zu deinem Bild";
$lang['user_comment_answer'] =  "Neue Antwort zu deinen Kommentar";
$lang['comment_image'] = "E-Mails bei neuen Kommentar zu ihren Bild:";
$lang['comment_answer'] = "E-Mails bei Antwort zu ihren Kommentar:";


5.) suche in templates/youTemplates/member_editprofile.html:
Code: [Select]
             {lang_no}
          </td>
          </tr>
füge darunter ein:

          
<tr
            <
td class="row1"><b>{lang_user_comment_image}</b></td>
            <
td class="row1"
              <
input type="radio" name="user_comment_image" value="1"{user_comment_image_yes}>
              {
lang_yes}&nbsp;&nbsp;&nbsp
              <
input type="radio" name="user_comment_image" value="0"{user_comment_image_no}>
              {
lang_no}
          </
td>
          </
tr>
           <
tr
            <
td class="row2"><b>{lang_user_comment_answer}</b></td>
            <
td class="row2"
              <
input type="radio" name="user_comment_answer" value="1"{user_comment_answer_yes}>
              {
lang_yes}&nbsp;&nbsp;&nbsp
              <
input type="radio" name="user_comment_answer" value="0"{user_comment_answer_no}>
              {
lang_no}
          </
td>
          </
tr>


6.) suche in der details.php:

$sql 
"SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."

ersetze es mit:

//######################### Send email when an answer to your Image "i.image_sendmail"
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits,i.image_sendmail".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."

6.1) suche:

$error 
0;
if (
$action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {

füge darüber ein:

//################## Start Send email when an answer to your Image #################################
  
if((empty($image_row['image_sendmail'])) && $is_image_owner){
    
$sql"UPDATE ".IMAGES_TABLE." SET image_sendmail = '1' WHERE image_id = $image_id";$site_db->query($sql);
  }
//################## End Send email when an answer to your Image ###################################

6.2) suche:

  $sql 
"SELECT cat_id, image_allow_comments
          FROM "
.IMAGES_TABLE."
          WHERE image_id = 
$id";
  
$row $site_db->query_firstrow($sql);

ersetze es mit:

 
//##### Send email when an answer to your Image "i.image_sendmail, u.user_comment_image,u.user_comment_answer"######
  
$sql "SELECT i.cat_id,i.image_name,i.user_id, i.image_allow_comments,i.image_sendmail, u.user_comment_image,u.user_comment_answer".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
          FROM "
.IMAGES_TABLE." i
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
          WHERE image_id = 
$id";
      
$result $site_db->query($sql);
    
$row $site_db->query_firstrow($sql);
    
$image_owner_id $row['user_id'];//Send email when an answer to your Image ###########

6.3) suche:

update_comment_count
($id$user_info['user_id']);

füge darunter ein:

// #################### Start Send email when an answer to your Image #####################################
      
$search_array = array(
        
'/\[quote(.*?)](.*?)\[\/quote\]/msi',
        
'/\[\/quote\]/msi',
        
'/\[url(.*?)](.*?)\[\/url\]/msi'
      
);
      
$comment_text preg_replace($search_array," ",$comment_text) ;
      
        if((
$is_image_owner == 0) && $row['user_comment_image'] && ($row['image_sendmail'] == 1)){  
          
$email_to = ($row['user_email']); 
          
$email_subject $lang['user_comment_image']; 
          
$site_mailtemplate->register_vars(array(
            
"lang_added_by" => $lang['added_by'],
            
"lang_comment" => $lang['comment'],
            
"lang_date" => $lang['date'],
            
"subject" => $email_subject,
            
"user_name" => $user_name
            
"image_owner_name" => $row['user_name'], 
            
"image_name" => $row['image_name'], 
            
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),
            
"image_url" => $script_url."/details.php?".URL_IMAGE_ID."=".$id."#comment".$commentid,
            
"message" => format_text(trim(stripslashes($comment_text)), 1)
          )); 
          
$email_template "comment_image_html"
          include(
ROOT_PATH.'includes/email_bridge.php');
          
$sql"UPDATE ".IMAGES_TABLE." SET image_sendmail = '0' WHERE image_id = $image_id";$site_db->query($sql);
        } 
        unset(
$email_to);       
// ################### End Send email when an answer to your Image #########################################
  
 //################### Start send email when an answer to your comment #####################################
    
$sql "SELECT c.comment_id, c.image_id, c.user_id, c.user_name,c.comment_sendmail,u.user_id, u.user_comment_answer".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
            FROM "
.COMMENTS_TABLE." c
            LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = c.user_id)
            WHERE c.image_id = 
$id AND c.comment_sendmail = 1 AND u.user_comment_answer = 1 AND u.user_id NOT IN ($image_owner_id,".$user_info['user_id'].") 
            "
;
    
$result $site_db->query($sql);
  
    
$user_comment_answer = array();
    while (
$answer_row $site_db->fetch_array($result)) {
      
$user_comment_answer[] = $answer_row['user_email'];
     }  
    
$site_db->free_result($result);
    
    if(!empty(
$user_comment_answer)){
      
$user_comment_answer =  array_unique($user_comment_answer);
      
$email_to =  implode(",",$user_comment_answer);
    }
    
    
$email_subject $lang['user_comment_answer']; 
    
$site_mailtemplate->register_vars(array(
      
"lang_added_by" => $lang['added_by'],
      
"lang_comment" => $lang['comment'],
      
"lang_date" => $lang['date'],
      
"subject" => $email_subject,
      
"user_name" => $user_info['user_name'], 
      
"image_name" => $row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),
      
"image_url" => $script_url."/details.php?".URL_IMAGE_ID."=".$id."#comment".$commentid,
      
"message" => format_text(trim(stripslashes($comment_text)), 1)
    )); 
    
$email_template "comment_answer_html"
    include(
ROOT_PATH.'includes/email_bridge.php');
    
    
$sql"UPDATE ".COMMENTS_TABLE." SET comment_sendmail = '0' WHERE image_id = $id AND user_id NOT IN (".$user_info['user_id'].")";$site_db->query($sql);
// #################### End Send email when an answer to your comment ############################################ 

6.4) suche:

  $sql 
"SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email").get_user_table_field(", u.""user_showemail").get_user_table_field(", u.""user_invisible").get_user_table_field(", u.""user_joindate").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_comments").get_user_table_field(", u.""user_homepage").get_user_table_field(", u.""user_icq")."

ersetze es mit:

//############# Send email when an answer to your comments in SQL Query "comment_sendmail"
  
$sql "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date,c.comment_sendmail".get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email").get_user_table_field(", u.""user_showemail").get_user_table_field(", u.""user_invisible").get_user_table_field(", u.""user_joindate").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_comments").get_user_table_field(", u.""user_homepage").get_user_table_field(", u.""user_icq")."

6.5) suche:

      $comments 
.= $site_template->parse_template("comment_bit");
    } 
// end while

füge darunter ein:

//######################## Start Send email when an answer to your comment ############################    
    
if($user_info['user_id']){
      
$sql"UPDATE ".COMMENTS_TABLE." SET comment_sendmail = '1' WHERE image_id = $image_id AND user_id = ".$user_info['user_id']."";$site_db->query($sql);
    }
//######################## End Send email when an answer to your comment ##############################


mfg Andi
« Last Edit: August 24, 2011, 07:59:44 PM by Rembrandt »

Offline Ronny5000

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #1 on: July 20, 2011, 11:10:33 AM »
Hallo Andi,

wenn jetzt "User01" ein Bild reinstellt, und "User02" das Bild Kommentiert bekommt ja "User01" eine Mail. Das klappt!
Sollte jetzt der Kommentar von "User02" zitiert werden, sagen wir von "User03", müsste jetzt "User01 und User02" eine Mail bekommen, oder? Wenn ja, das klappt nicht.
Fehlermeldungen bekomme ich keine. SMTP funzt perfekt. Nach genauer prüfung meiner Daten die ich nach der PERFEKTEN Anleitung geändert und hinzugefügt habe,
ist kein Fehler ersichtlich.

ODER, verstehe ich wieder mal was falsch?  :?  :oops:

Übrigens, Danke für die Arbeit die Du Dir für den Mod gemacht hast  :thumbup:

Gruß Ronny

Rembrandt

  • Guest
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #2 on: July 20, 2011, 11:41:49 AM »
Hi!
Quote
müsste jetzt "User01 und User02" eine Mail bekommen, oder
genau so funktioniert das.
hat "User01 und User02"  das auch im "Kontrollpanel auch aktiviert" das er ein E-Mail Benachrichtigung bekommen soll bei einer Antwort? (E-Mails bei Antwort zu ihren Kommentar:)";

die User bekommen aber immer nur eine Email zu dem Bild oder Kommentar, wenn sie dann das Bild nicht wieder besuchen bekommen sie keine weiteren Emails,
 erst wenn sie das Bild wieder Besuchen dann bekommen sie auch wieder eine Email.


mfg Andi
« Last Edit: July 23, 2011, 07:31:48 PM by Rembrandt »

Offline Ronny5000

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #3 on: July 20, 2011, 01:48:44 PM »
hat "User01 und User02"  das auch im "Kontrollpanel auch aktiviert" das er ein E-Mail Benachrichtigung bekommen sollen bei einer Antwort? (E-Mails bei Antwort zu ihren Kommentar:)";

 :oops: Ja, genau daran hat es gelegen (whis)
Danke Andi! Es wird langsam. Aber nur langsam  :mrgreen:

Gruß Ronny

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #4 on: July 22, 2011, 02:52:43 PM »
Hallo!
ist es auch möglich, diesen MOD auch ohne den MOD "Sende Emails als HTML" einzubauen?
Was muss ich ändern, damit es funktioniert?
Gruss Loda

Rembrandt

  • Guest
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #5 on: July 22, 2011, 03:29:12 PM »
...ist es auch möglich, diesen MOD auch ohne den MOD "Sende Emails als HTML" einzubauen?
Was muss ich ändern, damit es funktioniert?
...
Aus diesen Mod:[MOD] Sende Emails als HTML
Brauchst du nur Schritt 1.)  7.) u. 7.1)  aus der "html_email_files.zip" alle Dateien im Ordner "/includes/" ( das sind drei Dateien) und in "lang/yourLang/email/images/" die *.gifs

mfg Andi

« Last Edit: July 23, 2011, 01:33:36 PM by Rembrandt »

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #6 on: July 23, 2011, 10:06:33 AM »
Hallo Andi!
habe den schritt gemacht, bekomme aber immer eine Fehlermeldung:

Quote
Fatal error: Call to a member function register_vars() on a non-object in /home/www/c29d9187e6be60f0399c96d24da903c6/web/details.php on line 607

Zeile 607:
Code: [Select]
$site_mailtemplate->register_vars(array(
ich stehe auf'n Schlauch..

Rembrandt

  • Guest
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #7 on: July 23, 2011, 01:32:08 PM »
sorry mein Fehler, schritt 7.) u. 7.1) aus den anderen Mod brauchst du auch noch.

mfg Andi

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #8 on: July 23, 2011, 06:17:49 PM »
hallo Andi!
genial.. das funtz!
Dankeschön
Gruss Ralf

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #9 on: August 03, 2011, 11:01:05 AM »
Thanks for this mod... How to set "YES" values by default???

Rembrandt

  • Guest
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #10 on: August 03, 2011, 06:23:21 PM »
...How to set "YES" values by default
see attachment

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #11 on: August 03, 2011, 06:26:38 PM »
I need to change all files, or only refresh install_email.php??? Thanks!

Rembrandt

  • Guest
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #12 on: August 03, 2011, 06:42:56 PM »
I need to change all files, or only refresh install_email.php??? Thanks!
you ask:
Quote
Thanks for this mod... How to set "YES" values by default

i think you mean, "user_comment_answer" and "user_comment_image" set by default on "1"
ok, i make a installer for this,  and what is your problem now?

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #13 on: August 03, 2011, 07:05:03 PM »
No problems now. Thanks. All is fine! :-)

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] Send email when an answer to your Comments or Image
« Reply #14 on: August 07, 2011, 09:33:49 AM »
Hallo!
Eine sehr tolle Erweiterung ist dieser MOD, das muss ich dir mal sagen!
was jetzt noch das i-tüpfelchen wäre, wenn man die kommentarverfolgung in der detailansicht einstellen könnte und nicht allgemein über das memberprofil.
aber das wäre wirklich nur die krönung des ganzen.
nochmals danke für deine mühe und veröffentlichung dieser genialen erweiterung!
gruss Ralf