Author Topic: [Mod] Mail Owner of image when Comment is Posted  (Read 241006 times)

0 Members and 1 Guest are viewing this topic.

Offline Shard

  • Pre-Newbie
  • Posts: 5
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #60 on: May 27, 2003, 03:12:21 PM »
That makes sense. Will it also use the modified row names for that table that I have set in sessions.php? I mean, is it looking specifically for rows called user_name and User_email or will it go to sessions.php to pull the correct row names?

Offline deinsternchen

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #61 on: March 16, 2005, 04:06:00 PM »
Halli hallo,

also ich bin ganz neu hier und irgendwie komm ich nicht klar *heul*

Also ich hab das ganze jetzt mal so geändert und auch in den richtigen Verzeichnisen abgelegt. Ich bekomme aber keine Email *heul*

Ich habe allerdings unter den Bildern den usernamen entfernt, da es ja nur meine Bilder sind. Liegt das daran??? Wenn nicht, kann mir dann bitte jemand helfen - bevor ich meinen PC zum Fenster raus werfe.

Danke schon mal im voraus.

Sternchen

Offline vid_88

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #62 on: March 21, 2005, 02:47:07 PM »
Hm, seltsam...

Hier nochmal der komplette Block:

Quote
$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']);
    $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($lang['send_comment_emailsubject']);
    $site_email->register_vars(array(
      "user_name" => stripslashes($user_name),
            "recipient_name" => stripslashes($image_row['user_name']),
      "image_name" => $image_row['image_name'],
      "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);
}


und so sieht die comment_email.html bei mir aus:

Quote
Hallo {recipient_name},

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

Kommentar:

{comment_headline}

{comment_text}

Hier kannst du den Kommentar ansehen: {image_url}

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

Ich kann dir sonst beides (detail.php & comment_email.html) mal schicken wenn du möchtest.

Liebe Grüsse
Cancy

Can someone please translate this into English for me? This is exactly what I need!

Offline flash7

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #63 on: March 30, 2005, 01:46:03 PM »
Hello,

I've a problem because my USERS_TABLE is on vbulletin, $image_row['user_name'] and $image_row['user_email'] don't work!
Who can I do?

Thanks

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #64 on: March 30, 2005, 07:29:40 PM »
Hey Flash7,

I have no idea how Vbulletin names these table fields, but you should look for those fields in the database and edit them in php accordingly.

So if Vbulletin has a table field like username instead of user_name, you should change $image_row['user_name'] to $image_row['username']

Same for user_email.

Hope this helps.

Cheers,
Vraxor

Offline flash7

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #65 on: March 30, 2005, 09:48:53 PM »
Vraxor,

thank you...now work  :)

Offline GooSe_1977

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #66 on: April 28, 2005, 01:37:54 PM »
Hmm, hab das mal grad gemacht, aber irgendwie kriege ich keine e-mail ???

Michael

  • Guest
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #67 on: May 22, 2005, 07:07:28 PM »
Gibt es eine Möglichkeit, den User über neue Anmerkungen zu den Fotos zu informieren zu denen er bereits eine Anmerkung verfasst hat?
Noch besser wäre es wenn sich jeder User per Klick selber aussuchen könnte ob er eine
Benachrichtigun erhält sobald ein Kommentar zu dem ausgewählten Bild geschrieben wurde.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Is there a possibilty to inform users with e-mail if there are further comments at photos they`ve already commented.
So they can make discussions .Even better it would be if a user can choose by click at a button if he wants to be informed and by a click of a button he
could see if a new comment has been written to the photo.
I hope you understand what i mean.
Also other solutions in that way are o.k.



Gruß, Michael

Offline maziggy

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #68 on: June 22, 2005, 05:34:33 PM »
ok, chose:
1. only image owners can chose receive or not emails on new posted comments
2. any registered members can "subscribe" for any images they want, to receive emails on new posted comments.

the first variant is already exist (no offical mods though), u can see it at my site ;)

the second variant is not exist (I'm not aware of), but I was thinking to make it sometimes today.

I'm highly interested in those two functions. Is there a solution available in the meantime ?

Thanks, Martin

Offline marod0er

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #69 on: June 24, 2005, 08:48:19 PM »
This is a great MOD for people with much material belonging to people who sends in stuff! Like me! :D
Thanks
Greetz: Lasse

Offline Pitt

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #70 on: July 06, 2005, 04:31:03 PM »
Code: [Select]
Nun würde ich gerne in der Benachrichtigung auch noch angezeigt haben, wie der letzte Kommentator bewertet hat. Ungefähr so:

Kommentartext hier

Bewertung: X Punkte

Das funzt aber so nicht, denn Bewertung und Kommentar lassen sich ja nicht zusammen absenden, sondern geht ohne einen zusätzlich Hack nur einzeln...

Offline KSB-JiMbO

  • Pre-Newbie
  • Posts: 1
    • View Profile
    • KingSizeBeatz.de
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #71 on: July 15, 2005, 12:28:52 PM »
Hi,

THX very nice MOD!!  :mrgreen:
Is there any possibility to send the email and a pm via postnuke?
Would be great...

Greetz and THX,
JiMbO

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Revised
« Reply #72 on: July 22, 2005, 12:23:34 AM »
I've modified this nice MOD a bit... first of all, to get rid of those "Resource id #21", and second - to check, if user wants to recieve mails from admin. For this I've also added one field to User Profile, to let user choose himself, if he wans emails or not.

Code: [Select]
//-----------------------------------------------------
// Start Emailer for comments
//-----------------------------------------------------

    $recipient_name = $image_row['user_name'];
    $recipient_email = $image_row['user_email'];
    $image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";

$sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE user_name = '$recipient_name'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_allowemails = ($row['user_allowemails']);

if ($user_allowemails == 1) {
    $current_time = time();
    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("Comment Posted");
    $site_email->register_vars(array(
      "recipient_name" => $recipient_name,
      "image_name" => $image_row['image_name'],
      "comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
      "site_name" => $config['site_name'],
      "image_url" => $image_url,
    ));
    $site_email->set_body("comment_email", $config['language_dir']);
    $site_email->send_email();
}
//-------------------------------------------------------

Btw, the reason for "Resource id #" was using $image_name variable in sql query. I even removed these queries at all, because all necessary data alreary here, from the query at the very begining of page.

Add this table row to member_editprofile.html

Code: [Select]
         <tr>
            <td class="row2"><b>{lang_allow_emails}</b></td>
            <td class="row2">
              <input type="radio" name="user_allowemails" value="1"{user_allowemails_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_allowemails" value="0"{user_allowemails_no} />
              {lang_no}</td>
          </tr>

Hello,

i have put in this Code. But now i have user_allowemails Code in my file to become Mails from Admin yes or no.

Now i have change the Code. I have change all user_allowemails to user_allowmailcomments and i have made a table in .users called user_allowmailcomments .

My new code is this one

Details.php

Code: [Select]
//-----------------------------------------------------
// Start Emailer for comments
//-----------------------------------------------------

   $recipient_name = $image_row['user_name'];
   $recipient_email = $image_row['user_email'];
   $image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";

$sql = "SELECT user_allowmailcomments FROM ".USERS_TABLE." WHERE user_name = '$recipient_name'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_allowmailcomments = ($row['user_allowmailcomments']);

if ($user_allowmailcomments == 1) {
   $current_time = time();
   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("Kommentar geschrieben - Coment Posted");
   $site_email->register_vars(array(
     "recipient_name" => $recipient_name,
     "image_name" => $image_row['image_name'],
     "comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
     "site_name" => $config['site_name'],
     "image_url" => $image_url,
   ));
   $site_email->set_body("comment_email", $config['language_dir']);
   $site_email->send_email();
}
//-------------------------------------------------------

and in member_editprofile.htm this

Code: [Select]
<tr>
           <td class="row2"><b>{lang_user_allowmailcomments}</b></td>
           <td class="row2">
             <input type="radio" name="user_allowmailcomments" value="1"{user_allowmailcomments_yes} />
             {lang_yes}&nbsp;&nbsp;&nbsp;
             <input type="radio" name="user_allowmailcomments" value="0"{user_allowmailcomments_no} />
             {lang_no}</td>
         </tr>

But now i see this a i can´t save...

Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline CEGRAPHIX

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #73 on: July 25, 2005, 12:27:50 AM »
uh k......i'm gonna cry...or scream...whichever feels better...lol

i un get it....

i added info to details.php and uploaded the comment_email.html template....but....I STILL dont get emails when i test out comments on my own images....

it's supposed to email me even if I comment on myown photo right?

any ideas as to why i wouldnt get the email *i've tried using a different email address also*

Offline Toasti

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #74 on: August 24, 2005, 01:12:09 PM »
ich habe noch ein weiteres problem: 
nun werden bei mir jeweils mit einem abgegebenen kommentar zwei gleiche kommentare unter dem bild ausgegeben. 
 
was ist da zu tun?


====== translate in bad english :-( =======
I still have another problem: 
now, two same commentaries becomes form spent with me with a submitted commentary under him/it in each case. 
 
what is to be done there?


the part of my details.php:
Code: [Select]
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error = 0;
if ($action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
  $id = intval($HTTP_POST_VARS[URL_ID]);
  $sql = "SELECT cat_id, image_allow_comments
          FROM ".IMAGES_TABLE."
          WHERE image_id = $id";
  $row = $site_db->query_firstrow($sql);

  if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
    $msg = $lang['comments_deactivated'];
  }
  else {
    $user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    $comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    $comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

    // Flood Check
    $sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."
            WHERE image_id = $id
            ORDER BY comment_date DESC
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
      $error = 1;
    }

    $user_name_field = get_user_table_field("", "user_name");
    if (!empty($user_name_field)) {
      if ($site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("", "user_id")." <> '".$user_info['user_id']."'")) {
        $msg .= (($msg != "") ? "<br />" : "").$lang['username_exists'];
        $error = 1;
      }
    }
    if ($user_name == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['name_required'];
      $error = 1;
    }
    if ($comment_headline == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['headline_required'];
      $error = 1;
    }
    if ($comment_text == "")  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
      $error = 1;
    }

    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']);
 $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']);
   
    $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_subject("Neuer Kommentar");
    $site_email->set_from($config['site_email'], $config['site_name']);
   
    $site_email->register_vars(array(
      "user_name" => stripslashes($user_name),
            "recipient_name" => stripslashes($image_row['user_name']),
      "image_name" => $image_row['image_name'],
      "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);
}