Author Topic: [Mod] Notify sender on received eCard  (Read 73033 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Notify sender on received eCard
« on: February 16, 2003, 09:53:51 PM »
This MOD will send email notify to the sender, when eCard has been received/viewed by recipient.

----------------------------------------------------------------
Files to edit:
postcards.php
/lang/<yourlanguage>/main.php
/templates/<yourtemplate>/postcard_create.html
/templates/<yourtemplate>/postcard_preview.html

...............................................................................

New template:
/lang/<yourlanguage>/email/postcard_confirm.html
-----------------------------------------------------------------


Step 1.
Open postcards.php

Find:
Code: [Select]
 $recipient_email = un_htmlspecialchars(trim($HTTP_POST_VARS['recipient_email']));Add after:
Code: [Select]
$confirm = $HTTP_POST_VARS['confirm'];
1.2
Find:
Code: [Select]
 $sql = "INSERT INTO ".POSTCARDS_TABLE."
          (postcard_id, image_id, postcard_date, postcard_bg_color, postcard_border_color, postcard_font_color, postcard_font_face, postcard_sender_name, postcard_sender_email, postcard_recipient_name, postcard_recipient_email, postcard_headline, postcard_message)
          VALUES
          ('$postcard_id', $image_id, $current_time, '$bg_color', '$border_color', '$font_color', '$font_face', '$sender_name', '$sender_email', '$recipient_name', '$recipient_email', '$headline', '$message')";
  $result = $site_db->query($sql);
Replace with:
Code: [Select]
 $sql = "INSERT INTO ".POSTCARDS_TABLE."
          (postcard_id, image_id, postcard_date, postcard_bg_color, postcard_border_color, postcard_font_color, postcard_font_face, postcard_sender_name, postcard_sender_email, postcard_recipient_name, postcard_recipient_email, postcard_headline, postcard_message, postcard_confirm)
          VALUES
          ('$postcard_id', $image_id, $current_time, '$bg_color', '$border_color', '$font_color', '$font_face', '$sender_name', '$sender_email', '$recipient_name', '$recipient_email', '$headline', '$message', '$confirm')";
  $result = $site_db->query($sql);

1.3.
Find:
Code: [Select]
   $sql = "SELECT p.postcard_id, p.image_id, p.postcard_date, p.postcard_bg_color, p.postcard_border_color, p.postcard_font_color, p.postcard_font_face, p.postcard_sender_name, p.postcard_sender_email, p.postcard_recipient_name, p.postcard_recipient_email, p.postcard_headline, p.postcard_message, i.image_name, i.cat_id, i.image_media_file, i.image_thumb_file
            FROM ".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i
            WHERE p.postcard_id = '$postcard_id' AND p.image_id = i.image_id";
    $image_row = $site_db->query_firstrow($sql);
Replace with:
Code: [Select]
   $sql = "SELECT p.postcard_id, p.image_id, p.postcard_date, p.postcard_bg_color, p.postcard_border_color, p.postcard_font_color, p.postcard_font_face, p.postcard_sender_name, p.postcard_sender_email, p.postcard_recipient_name, p.postcard_recipient_email, p.postcard_headline, p.postcard_message, i.image_name, i.cat_id, i.image_media_file, i.image_thumb_file, p.postcard_confirm
            FROM ".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i
            WHERE p.postcard_id = '$postcard_id' AND p.image_id = i.image_id";
    $image_row = $site_db->query_firstrow($sql);

1.4.
Find:
4images older then v1.7.7
Code: [Select]
   if (!$image_row) {
      $msg = $lang['invalid_postcard_id'];
    }
    else {
4images v1.7.7 or newer
Code: [Select]
    if (!$image_row) {
      show_error_page($lang['invalid_postcard_id']);
    }
    else {

Add after:
Code: [Select]
if ($msg == "" && $image_row['postcard_confirm'] == 1) {
$sql = "UPDATE ".POSTCARDS_TABLE."
SET postcard_confirm = 0
WHERE postcard_id = '$postcard_id'";
$site_db->query($sql);
$current_time = time();
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to(stripslashes($image_row['postcard_sender_email']), stripslashes($image_row['postcard_sender_name']));
$site_email->set_from(stripslashes($config['site_email']), "");
$site_email->set_subject($lang['postcard_confirm_subj']);
$site_email->register_vars(array(
"recipient_name" => stripslashes($image_row['postcard_sender_name']),
"recipient_email" => stripslashes($image_row['postcard_sender_email']),
"sender_name" => stripslashes($image_row['postcard_recipient_name']),
"sender_email" => stripslashes($image_row['postcard_recipient_email']),
"postcard_send_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
"site_url" => $script_url."/details.php?".URL_IMAGE_ID."=".$image_row['image_id'],
"site_name" => $config['site_name']
));
$site_email->set_body("postcard_confirm", $config['language_dir']);
$site_email->send_email();
}

1.5.
Find:
Code: [Select]
   $main_template = "postcard_preview";
    $image = get_media_code($image_row['image_media_file'], $image_id, $cat_id, $image_row['image_name'], $mode, 1);
    $thumbnail = get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_id, $cat_id, $image_row['image_name'], $mode);
    $site_template->register_vars(array(
Add right after:
Code: [Select]
"lang_postcard_confirm" => $lang['postcard_confirm'],
"postcard_confirm" => ($HTTP_POST_VARS['confirm'] == 1) ? $lang['yes'] : $lang['no'],
"confirm" => $HTTP_POST_VARS['confirm'],

1.6.
Find:
Code: [Select]
if ($action == "createcard") {
  if (!$sendprocess) {
    $bg_color = "";
    $border_color = "";
    $font_color = "";
    $font_face = "";
    $sender_name = ($user_info['user_level'] != GUEST) ? $user_info['user_name'] : "";
    $sender_email = ($user_info['user_level'] != GUEST) ? $user_info['user_email'] : "";
    $recipient_name = "";
    $recipient_email = "";
    $headline = "";
    $message = "";
  }
  $image = get_media_code($image_row['image_media_file'], $image_id, $cat_id, $image_row['image_name'], $mode, 1);
  $thumbnail = get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_id, $cat_id, $image_row['image_name'], $mode);
  $site_template->register_vars(array(
Add right after:
Code: [Select]
"lang_postcard_confirm" => $lang['postcard_confirm']."?",

Step 2.
Open /lang/<yourlanguage>/main.php

Add at the end of the file, just before ?> :
Code: [Select]
$lang['postcard_confirm'] = "Receive confirmation when postcard viewed";
$lang['postcard_confirm_subj'] = "eCard confirmation";


Step 3.
Open /templates/<yourtemplate>/postcard_create.html

Add this:
Code: [Select]
<TR>
<TD class="row1" valign="top"><B>{lang_postcard_confirm}</B></TD>
<TD class="row1" valign="top">
<INPUT type="checkbox" name="confirm" value="1" checked>
</TD>
</TR>


Step 4.
Open /templates/<yourtemplate>/postcard_preview.html

Add this:
Code: [Select]
<B>{lang_postcard_confirm}:</B> {postcard_confirm}and this:
Code: [Select]
   <INPUT type="hidden" name="confirm" value="{confirm}" />

Step 5.
Create new template /lang/<yourlanguage>/email/postcard_confirm.html
Insert this:
Code: [Select]
Dear {recipient_name},

{sender_name} ({sender_email}) received your eCard!

{site_url}
--
Best regards,
{site_name}


Step 6.
Download install_ecard.zip ... then unzip it, upload it to 4images ROOT dir and start it. [ update 04.01.2007 by mawenzi ]

Now, when u are sending eCard, u have an option to receive a notify, when your recipient viewed the eCard.

http://gallery.vano.org/postcard7570

P.S. sorry for my bad english, if u think of better text for this mod, let me know.
« Last Edit: July 31, 2010, 09:27:49 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fabulous

  • Newbie
  • *
  • Posts: 15
    • View Profile
    • http://www.foto-fish.de
[Mod] Notify sender on received eCard
« Reply #1 on: February 17, 2003, 04:21:21 PM »
i just did it, works perfectly, thanks V@no :D

Offline edndale

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • http://edndale.com/postcard
Reply and {postcard_url}
« Reply #2 on: February 18, 2003, 02:54:59 AM »
I tried this edit in the
lang/<your language>/email
templates for the newly created
postcard_confirm.html
**************************
Dear {recipient_name},

<A href=mailto:{sender_email}>{sender_name}</A> received your eCard!

{postcard_url}

{site_url}
--
Best regards,
{site_name}
***********************

But the reply in email prints as:

Dear testing,

<A href=mailto:someoone@home.com>Mr. Someone</A> received your eCard!

{postcard_url}

http://yoursite.com/postcard/details.php?image_id=78
--
Best regards,
Your Gallery


The postcard_url doesn't get printed while the site_url does...

QUESTION 1:
Is there another step to have {postcard_url} process like it does in postcard_message.html?

QUESTION 2:
Can html tags be used in the email confirmation?
 :roll:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Notify sender on received eCard
« Reply #3 on: February 18, 2003, 04:06:36 AM »
Answer 1:
in Step 1.4. add
Code: [Select]
     "url_postcard" => $script_url."/postcards.php?".URL_POSTCARD_ID."=".$postcard_id,
after
Code: [Select]
"site_url" => $script_url."/details.php?".URL_IMAGE_ID."=".$image_row['image_id'],

Answer 2:
4images uses plain text for sending emails, so, it's not possible now.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline irishblue

  • Pre-Newbie
  • Posts: 8
    • View Profile
[Mod] Notify sender on received eCard
« Reply #4 on: February 26, 2003, 06:46:47 PM »
how did you do the swatches color selection on your site? looks good!  :)  could you show us how you did that? instead of the few default colors we are given. Thanks!

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Ya V@no
« Reply #5 on: March 18, 2003, 02:53:08 AM »
Yes V@no would you share with us how you do that [ selecting color on E-card ]

 :wink:  :wink:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Ya V@no
« Reply #6 on: March 18, 2003, 05:44:47 AM »
Quote from: mantra
Yes V@no would you share with us how you do that [ selecting color on E-card ]

 :wink:  :wink:

here is my template:
http://come.no-ip.com/postcard_create.phps
also, u'll need that "colors" image.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Thanks V@no
« Reply #7 on: March 21, 2003, 01:39:16 AM »
Thanks V@no :D
100% NICE

Offline Harry

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • http://7summits.com
Re: Ya V@no
« Reply #8 on: March 30, 2003, 04:15:20 PM »
Quote from: V@no
Quote from: mantra
Yes V@no would you share with us how you do that [ selecting color on E-card ]

 :wink:  :wink:

here is my template:
http://come.no-ip.com/postcard_create.phps
also, u'll need that "colors" image.


Hello V@no,

I think I got it to work, but one of the nasty side effects seems to be that the "modify your ecard" button does not work anymore. I tried it on your site as well and that has the same problem. Do you have any idea how to fix this? If you cannot edit your ecard there is no use of a preview...

(edit:) I just discovered ths has nothing to do with the mod (I think?!?) But the problem is there; is this a bug of the main script?

Thanks,
Harry
Trips & Expeditions to the 7 summits: the highest mountains on the seven continents. Kilimanjaro, Aconcagua and more!
Check out http://7summits.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Ya V@no
« Reply #9 on: March 30, 2003, 04:29:40 PM »
Quote from: Harry
I tried it on your site as well and that has the same problem.

HUH???  8O  8O  8O
hehe.
I'm not quet sure what are u talking about, it working perfectly for me.

Make sure that JavaScript is anabled on your system, because "back" button uses javascript to go back in the "history".
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Harry

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • http://7summits.com
Re: Ya V@no
« Reply #10 on: March 30, 2003, 06:21:15 PM »
Quote from: V@no
Quote from: Harry
I tried it on your site as well and that has the same problem.

HUH???  8O  8O  8O
hehe.
I'm not quet sure what are u talking about, it working perfectly for me.

Make sure that JavaScript is anabled on your system, because "back" button uses javascript to go back in the "history".


errr, rebooting helps!  8O  :?  :roll:

Seems to be a cache problems with the postcards.php script, still happens every now and then..

Butyour script works now, I have altered the layout and some options quite abit, you can see it at: http://7summits.com/images

Thanks again for the mod,
Harry
Trips & Expeditions to the 7 summits: the highest mountains on the seven continents. Kilimanjaro, Aconcagua and more!
Check out http://7summits.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Notify sender on received eCard
« Reply #11 on: March 30, 2003, 06:50:29 PM »
works just fine to me.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MiG26

  • Pre-Newbie
  • Posts: 1
    • View Profile
    • http://www.mig26.com
Sender notify on eCard received
« Reply #12 on: April 01, 2003, 05:10:35 PM »
Quote from: V@no
works just fine to me.


and for me,  :D
tanks you all for your help

http://www.mig26.com/pictures

Offline Shap

  • Full Member
  • ***
  • Posts: 114
    • View Profile
[Mod] Notify sender on received eCard
« Reply #13 on: April 02, 2003, 02:53:43 AM »
Very Nice!!!

Could it be possible to auto blind carbon copy an email to the admin, kind of a way to count or see how many ecards are getting sent?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Notify sender on received eCard
« Reply #14 on: April 02, 2003, 03:52:30 AM »
Quote from: Shap
Very Nice!!!

Could it be possible to auto blind carbon copy an email to the admin, kind of a way to count or see how many ecards are getting sent?

yes, it's not a problem, but...I'd reather make some eCards stats, something like "Keep Track Of What Each User Has Downloaded
Any valuntiers to make something like that? :wink: :D
btw, I already implimented something like that into my site, u can see it in memberlist
right now the code is tooooooo massy, as soon as I clean it up little bit, I'll post it (unless someone else do it ;))
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)