4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Rembrandt on July 17, 2011, 08:18:01 PM

Title: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt 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  (http://www.4homepages.de/forum/index.php?topic=29749.0)
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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Ronny5000 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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt 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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Ronny5000 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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Loda 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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt 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  (http://www.4homepages.de/forum/index.php?topic=29749.0)
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

Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Loda 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..
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt 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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Loda on July 23, 2011, 06:17:49 PM
hallo Andi!
genial.. das funtz!
Dankeschön
Gruss Ralf
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: MrAndrew on August 03, 2011, 11:01:05 AM
Thanks for this mod... How to set "YES" values by default???
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt on August 03, 2011, 06:23:21 PM
...How to set "YES" values by default
see attachment
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: MrAndrew on August 03, 2011, 06:26:38 PM
I need to change all files, or only refresh install_email.php??? Thanks!
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt 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?
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: MrAndrew on August 03, 2011, 07:05:03 PM
No problems now. Thanks. All is fine! :-)
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Loda 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
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt on March 30, 2012, 01:20:29 PM
Hi!
nein funktioniert nicht.
Ich hatte die Meldung auch Seinerzeit, hatte dann etwas geändert und weg war sie.
Muß mal schauen woran das lag.
Vorab kannst du das hier machen.
http://www.4homepages.de/forum/index.php?topic=29749.msg161033#msg161033

mfg Andi

Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: heinier on March 30, 2012, 02:32:00 PM
Hi! Danke für deine schnelle Antwort!

Ok! Schade.

Den Tipp für die Fehlermeldung werde ich mal ausprobieren!

Vielleicht habe ich hier auch den falschen Mod erwischt.
Ich suche nach einer Möglichkeit, sobald irgendein User, registriert oder nicht, zu einen Bild einen Kommentar abgibt, ich eine Nachricht bekomme, damit ich nicht jedesmal im Adminbereich nachschauen muß, ob jemand etwas gepostet hat.

Gruß Heinier

Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Schtorsch on July 03, 2012, 12:40:04 AM
Irgendwie klappt das bei mir nicht...  :cry:

Hatte zunächst die Änderungen von hier eingebaut -> http://www.4homepages.de/forum/index.php?topic=24185.0
Das ging ohne Probleme. Zumindest fast. Nur der Radio-Button klappte nicht.

Nun hab ich den Mod wieder rausgeschmissen und die Anleitung hier befolgt. Jetzt bekomme ich aber beim Aufruf der details.php folgenden Fehler:

Code: [Select]
Parse error: syntax error, unexpected $end in /www/htdocs/w0089eb4/4images/details.php on line 790
Line 790 ist aber nix. Das ist das Ende der php...

Hilfe!  :oops:
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Rembrandt on July 03, 2012, 04:26:54 AM
Irgendwie klappt das bei mir nicht...  :cry:
....
Line 790 ist aber nix. Das ist das Ende der php...
...
du hast bei deinen ein aus umbau, irgendwo eine Klammer vergessen { }

mfg Andi
Title: Re: [Mod] Send email when an answer to your Comments or Image
Post by: Schtorsch on July 03, 2012, 08:38:24 AM
Es war gestern/heute wohl doch etwas spät... Hab nochmal das Backup genommen und die details.php neu verändert - und nun gehts perfekt!

DANKE!  :D