4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 30, 2014, 06:12:06 PM

Login with username, password and session length
Search:     Advanced search
You're looking for some 4images templates and styles? Then visit this thread to show websites with 4images templates to download.
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Requests & Discussions) (Moderators: mawenzi, Rembrandt)
| | |-+  [MOD] Email when comment written all in one
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: [MOD] Email when comment written all in one  (Read 2926 times)
x23piracy
Sr. Member
****
Offline Offline

Posts: 420

Thank You
-Given: 48
-Receive: 40


View Profile WWW
« on: November 18, 2010, 10:05:14 AM »

Hi,

da es mich ziemlich nervt wenn man sich seine Infos aus etlichen Threads zusammensuchen muss,
hier mal die Zusammenfassung.

Die Änderung von Andi bzgl. des Datums ist hier schon eingeflossen


Email verschicken wenn ein Kommentar geschrieben wurde:

Schritt 1.

Suche in details.php:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
    }
  }
  unset(
$row);
  unset(
$spam_row);
}


Ersetze mit (wenn nur der User eine Email erhalten soll):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
   if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
        
$sql "SELECT image_name FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$image_name $site_db->query($sql); 
    
$sql "SELECT user_id FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$user_id $site_db->query($sql); 
    
    
$recipient_name $image_row['user_name']; 
    
$recipient_email $image_row['user_email'];
    
$image_url $script_url."/details.php?".URL_IMAGE_ID."=".$id.""

    
    
// Start Emailer für comments 
    
include(ROOT_PATH.'includes/email.php'); 
    
$site_email = new Email(); 
    
$site_email->set_to($recipient_email); 
    
$site_email->set_from($config['site_email'], $config['site_name']); 
    
$site_email->set_subject("Neuer Kommentar zu deinem Bild"); 
    
$site_email->register_vars(array( 
      
"user_name" => $image_row['user_name'], 
      
"recipient_name" => $recipient_name
      
"image_name" => $image_row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),
      
"site_name" => $config['site_name'],
      
"image_url" => $image_url,
      
"comment_text" =>$comment_text,
      
"comment_headline"=>$comment_headline,
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email(); 
    }
  }
  unset(
$row);
  unset(
$spam_row);
}

oder...

Ersetze mit (wenn nur der Admin eine Email erhalten soll):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
   if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
        
$sql "SELECT image_name FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$image_name $site_db->query($sql); 
    
$sql "SELECT user_id FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$user_id $site_db->query($sql); 
    
    
$recipient_name $image_row['user_name']; 
    
$recipient_email $image_row['user_email'];
    
$image_url $script_url."/details.php?".URL_IMAGE_ID."=".$id.""
    
    
// Start Admin-Mail 
    
$recipient_name $config['site_name'];
    
$recipient_email $config['site_email'];

    
$site_email = new Email(); 
    
$site_email->set_to($recipient_email); 
    
$site_email->set_from($config['site_email'], $config['site_name']); 
    
$site_email->set_subject("Neuer Kommentar wurde geschrieben"); 
    
$site_email->register_vars(array( 
      
"user_name" => $image_row['user_name'], 
      
"recipient_name" => $recipient_name
      
"image_name" => $image_row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),
      
"site_name" => $config['site_name'],
      
"image_url" => $image_url,
      
"comment_text" =>$comment_text,
      
"comment_headline"=>$comment_headline,
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email(); 
    }
  }
  unset(
$row);
  unset(
$spam_row);
}

oder...

Ersetze mit (wenn sowohl der Admin als auch der User eine Email erhalten sollen):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
   if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
        
$sql "SELECT image_name FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$image_name $site_db->query($sql); 
    
$sql "SELECT user_id FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$user_id $site_db->query($sql); 
    
    
$recipient_name $image_row['user_name']; 
    
$recipient_email $image_row['user_email'];
    
$image_url $script_url."/details.php?".URL_IMAGE_ID."=".$id.""

    
    
// Start Emailer für comments 
    
include(ROOT_PATH.'includes/email.php'); 
    
$site_email = new Email(); 
    
$site_email->set_to($recipient_email); 
    
$site_email->set_from($config['site_email'], $config['site_name']); 
    
$site_email->set_subject("Neuer Kommentar zu deinem Bild"); 
    
$site_email->register_vars(array( 
      
"user_name" => $image_row['user_name'], 
      
"recipient_name" => $recipient_name
      
"image_name" => $image_row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),
      
"site_name" => $config['site_name'],
      
"image_url" => $image_url,
      
"comment_text" =>$comment_text,
      
"comment_headline"=>$comment_headline,
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email();
    
    
// Start Admin-Mail 
    
$recipient_name $config['site_name'];
    
$recipient_email $config['site_email'];

    
$site_email = new Email(); 
    
$site_email->set_to($recipient_email); 
    
$site_email->set_from($config['site_email'], $config['site_name']); 
    
$site_email->set_subject("Neuer Kommentar wurde geschrieben"); 
    
$site_email->register_vars(array( 
      
"user_name" => $image_row['user_name'], 
      
"recipient_name" => $recipient_name
      
"image_name" => $image_row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),  
      
"site_name" => $config['site_name'],
      
"image_url" => $image_url,
      
"comment_text" =>$comment_text,
      
"comment_headline"=>$comment_headline,
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email(); 
    }
  }
  unset(
$row);
  unset(
$spam_row);
}



Schritt 2.

Erstelle in Verzeichnis ../lang/[deine Sprache]/email/ die Datei "comment_email.html"

Diese Datei stellt den Mail Body also die Nachricht dar, innerhalb dieser Datei können
folgende Variablen verwendet werden:

  • {recipient_name}
  • {user_name}
  • {image_name}
  • {site_name}.
  • {comment_headline}
  • {comment_text}
  • {image_url}
  • {comment_date}

Ein fertiges Beispiel für ein Email Template wäre z.B.:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Hallo {recipient_name},

{user_name} gab einen Kommentar zu deinem Bild "{image_name}" ab in {site_name}.

Kommentar:

{comment_headline}

{comment_text}

Hier kannst du den Kommentar ansehen: {image_url}

Datum: {comment_date}

------
Mit freundlichen Grüssen,
{site_name}


Schritt 3 (optional)

Wer seinen Usern noch anbieten möchte selbst zu entscheiden ob Sie bei neuen Kommentaren
zu Ihren Bildern eine Email wünschen ist folgendes notwendig:

Datenbank erweitern:

1
2
ALTER TABLE 4images_users ADD (user_mail_text INT UNSIGNED);
UPDATE 4images_users SET user_mail_text =1;

Datenbankfeld bekannt machen:

Ergänze in db_field_definitions.php:
1
$additional_user_fields['user_mail_text'] = array($lang['mail_text'], "radio", 0);

Ergänze in member_editprofile.html:

1
2
3
4
5
6
7
8
9
10
11
<!-- Mod Mail -->
<tr>
            <td class="row2"><b>Benachrichtigung bei Kommentar</b></td>
            <td class="row2">
              <input type="radio" name="user_mail_text" value="1"{user_mail_text_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_mail_text" value="0"{user_mail_text_no} />
              {lang_no}
            </td>
          </tr>
<!-- Mod Mail -->


Tweaks:

Wer seine User nicht zwingen möchte einen Kommentar-Betreff zu schreiben macht folgendes:

in der details.php löschen/auskommentieren:
1
2
3
4
if ($comment_headline == "")  {
  $msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
  $error = 1;
}


Um auch im ACP Bereich davon befreit zu sein:

in der admin/comments.php löschen/auskommentieren:
1
2
3
 if ($comment_headline == "") {
    $error['comment_headline'] = 1;
  }


Falls diese Art von zusammentragen auf Freude stößt verschiebt das ganze ein Mod ins richtige Forum.


Gruß Jens





Follow members gave a thank to your post:
Sumale.my

For this post, 1 member gave a thank you!
Logged


Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 158
-Receive: 75

Neverdie


View Profile
« Reply #1 on: November 25, 2010, 08:45:03 PM »

In 1.7.9 läuft es nicht!
Der Code der ersetzt wird, ist anders und sieht so aus:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
      
$site_sess->set_session_var("msgdetails"$msg);
      
redirect(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode "").(($page 1) ? "&page=".$page ""));
    }
  }
  unset(
$row);
  unset(
$spam_row);
}

Ich habe das so abgeändert.... aber bekomme kein Mail
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
   if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
      
$site_sess->set_session_var("msgdetails"$msg);
      
redirect(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode "").(($page 1) ? "&page=".$page ""));
        
$sql "SELECT image_name FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$image_name $site_db->query($sql); 
    
$sql "SELECT user_id FROM ".IMAGES_TABLE." WHERE image_id = $id"
    
$user_id $site_db->query($sql); 
    
    
$recipient_name $image_row['user_name']; 
    
$recipient_email $image_row['user_email'];
    
$site_sess->set_session_var("msgdetails"$msg);
    
redirect(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode "").(($page 1) ? "&page=".$page ""));

    
    
// Start Emailer f&#252;r comments 
    
include(ROOT_PATH.'includes/email.php'); 
    
$site_email = new Email(); 
    
$site_email->set_to($recipient_email); 
    
$site_email->set_from($config['site_email'], $config['site_name']); 
    
$site_email->set_subject("Neuer Kommentar zu deinem Bild"); 
    
$site_email->register_vars(array( 
      
"user_name" => $image_row['user_name'], 
      
"recipient_name" => $recipient_name
      
"image_name" => $image_row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),
      
"site_name" => $config['site_name'],
      
"image_url" => $image_url,
      
"comment_text" =>$comment_text,
      
"comment_headline"=>$comment_headline,
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email();
    
    
// Start Admin-Mail 
    
$recipient_name $config['site_name'];
    
$recipient_email $config['site_email'];

    
$site_email = new Email(); 
    
$site_email->set_to($recipient_email); 
    
$site_email->set_from($config['site_email'], $config['site_name']); 
    
$site_email->set_subject("Neuer Kommentar wurde geschrieben"); 
    
$site_email->register_vars(array( 
      
"user_name" => $image_row['user_name'], 
      
"recipient_name" => $recipient_name
      
"image_name" => $image_row['image_name'], 
      
"comment_date" => format_date($config['date_format']." ".$config['time_format'], time()),  
      
"site_name" => $config['site_name'],
      
"image_url" => $image_url,
      
"comment_text" =>$comment_text,
      
"comment_headline"=>$comment_headline,
          )); 
    
$site_email->set_body("comment_email"$config['language_dir']); 
    
$site_email->send_email(); 
    }
  }
  unset(
$row);
  unset(
$spam_row);
}
Logged
x23piracy
Sr. Member
****
Offline Offline

Posts: 420

Thank You
-Given: 48
-Receive: 40


View Profile WWW
« Reply #2 on: November 25, 2010, 10:16:40 PM »

Hi,

ich hab das in 1.7.9 am laufen!... komisch
mailing generell i.O.?


Gruß Jens
Logged


Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 158
-Receive: 75

Neverdie


View Profile
« Reply #3 on: November 26, 2010, 05:59:35 PM »

Mailing ist genrell in Ordnung

Generell findet man den Code so
1
2
3
4
5
6
7
8
9
10
11
12
13
14
if (!$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
    }
  }
  unset(
$row);
  unset(
$spam_row);
}
in der details.php nicht
Logged
Scarala
Jr. Member
**
Offline Offline

Posts: 60

Thank You
-Given: 5
-Receive: 15


View Profile WWW
« Reply #4 on: November 15, 2012, 08:04:43 AM »

Ich hab das selbe Problem wie Sumale.nin

Hab alles so eingebaut wie im ersten posting beschrieben, nur halt das selbe wie bei Sumale.nin, das der code in der details.php anders aussieht.

nachdem ich die Zeilen

1
2
      $site_sess->set_session_var("msgdetails"$msg);
      
redirect(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode "").(($page 1) ? "&page=".$page ""));
gelöscht habe, funktionierte alles fehlerfrei.
Logged

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.147 seconds with 22 queries.