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

0 Members and 1 Guest are viewing this topic.

Offline uae

  • Newbie
  • *
  • Posts: 13
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #15 on: December 18, 2002, 01:08:10 PM »
To have the Server Date and Time,

Add this line in your details.php

Code: [Select]
   $current_time = time();

Befor this

Code: [Select]

    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->set_subject($lang['send_comment_emailsubject']);
    $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'], $current_time),
      "site_name" => $config['site_name'],
      "image_url" => $image_url,
          ));
    $site_email->set_body("comment_email", $config['language_dir']);
    $site_email->send_email();


So it should look like

Code: [Select]
           
    $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->set_subject($lang['send_comment_emailsubject']);
    $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'], $current_time),
      "site_name" => $config['site_name'],
      "image_url" => $image_url,
          ));
    $site_email->set_body("comment_email", $config['language_dir']);
    $site_email->send_email();


Good Luck

Offline HUNTER

  • Newbie
  • *
  • Posts: 18
    • View Profile
all works fine
« Reply #16 on: December 18, 2002, 08:41:10 PM »
but in the navigation bar i see this:

Home / Nature / Resource id #21

What is "Resource id #21"

before posting the comment nav bar looks like:

Home / Nature / TreeForest

Offline HUNTER

  • Newbie
  • *
  • Posts: 18
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #17 on: January 03, 2003, 08:39:24 AM »
anybody can help me??

Offline Vraxor

  • Full Member
  • ***
  • Posts: 134
    • View Profile
    • http://tc-revolution.net
[Mod] Mail Owner of image when Comment is Posted
« Reply #18 on: January 03, 2003, 09:34:13 AM »
NO sorry, Hunter, I don't really understand that either, but maybe somebody else does. It aint a problem for me though.

Cheers,
Vraxor

Offline HUNTER

  • Newbie
  • *
  • Posts: 18
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #19 on: January 03, 2003, 09:56:37 AM »
ok...I will continiue waiting for someone else you can fix this, mod is really good, but buggy :(

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Revised
« Reply #20 on: January 15, 2003, 11:06:49 PM »
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>

Offline HUNTER

  • Newbie
  • *
  • Posts: 18
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #21 on: January 16, 2003, 07:27:39 AM »
Thanks for fixing, but I found in a member_profile.html some code as you type below

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>


This is a default button for disabling recieving notifications from a admin? That already has in a user contol panel?

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #22 on: January 16, 2003, 10:43:33 AM »
Quote from: HUNTER
Thanks for fixing, but I found in a member_profile.html some code as you type below


Sorry for confusion. I'm using 4blue_orange1 template, and just found out that for some reason this row was removed from template. Since you already have it in yours, you don't have to add anything..

Offline Kingofclasspix

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • http://www.jatrixhome.de
E-mail to al users who posted comments, too?
« Reply #23 on: February 07, 2003, 08:13:03 PM »
Hi,

on my website, vistors often discuss in the comments.

So for me it would be very useful to have an email sent to everyone, who has posted a comment, not only to the owner of the image.

is this possible?

cya, Jörg

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #24 on: February 07, 2003, 10:14:43 PM »
Hi for some reason the code SLL posted wont send me the email....maybe it's because I have removed the button on the user profile to disable them from picking? I would like to leave it removed from there profile but also have SLL code to work...any ideas?

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #25 on: February 07, 2003, 10:44:20 PM »
Quote from: Jasondavis
I would like to leave it removed from there profile but also have SLL code to work...any ideas?

take away
Quote
if ($user_allowemails == 1) {
line and one "}" at the very bottom

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #26 on: February 07, 2003, 10:53:10 PM »
thanks that worked, but gave me 1 more problem....the email it sent me said

{user_name}, instead of my username

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #27 on: February 07, 2003, 11:13:25 PM »
That means you've modified something else in this file. Try original MOD code, which you can find in the beginning of this thread.

Offline Jasondavis

  • Full Member
  • ***
  • Posts: 157
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #28 on: February 07, 2003, 11:31:13 PM »
Quote from: SLL
That means you've modified something else in this file. Try original MOD code, which you can find in the beginning of this thread.


hmm confused I just started out fresh and it worked with the original code.  I then modified it and now is still doesnt insert the username...anymore ideas? Thanks

Also everything else worked fine, the
Resource id #21 is gone
it sends the email to me when I post a comment on an image i added
the image name is correct in the email and so it the date and time and everything....just wont replace {user_name} with my name which is Jason in my gallery

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Mail Owner of image when Comment is Posted
« Reply #29 on: February 08, 2003, 10:43:27 AM »
Change the template like this:
Quote
Dear {recipient_name}, ........