Page 1 of 1

Copy of post to visitor ?

Posted: Wed Dec 30, 2009 6:51 am
by jaap
Version of script: 1.7

Hi Henrie,

In version 1.7 I don't see the option to send a copy of the post to the visitor after signing the guestbook ?

Your version had this option.

Jaap.

Posted: Wed Dec 30, 2009 6:41 pm
by Henrie
Hello Jaap,

I thought i could just take the solution out of my HL-mod version guestbook and paste it in version 1.7, but it took a little more modification.

But it is done now.

Notification posts to the visitor for GBook version 1.7

Open file gbook.php

Part 1 of 4: Notification of normal post
Search for (lines 993-994)

Code: Select all

/* Let the first page know a new entry has been submitted */
define('NOTICE',$lang['t47']);
Paste the following code directly before it on empty line 992.

Code: Select all

    /* Notification posts to the visitor modification by Henrie >> part 1 of 4: Notification of normal post */
    if (!(empty($email)) && $settings['notify_visitor'] == 1)
    {
      $char = array('.','@');
      $repl = array('.','@');
      $email=str_replace($repl,$char,$email);
      $message = sprintf($lang['t76'],$name)."\n\n";
      $message.= sprintf($lang['hl_t02'],$settings['gbook_title'])."\n\n";
      $message.= "$lang[hl_t03]\n";
      $message.= "$lang[t17] $name\n";
      $message.= "$lang[t18] $from\n";
      $message.= "$lang[t20] $email\n";
      $message.= "$lang[t19] $url\n";
      $message.= "$lang[t44]\n";
      $message.= "$comments_nosmileys\n\n";
      $message.= "$lang[hl_t04]\n";
      $message.= "$settings[gbook_url]\n\n";
      $message.= "$lang[t79]\n\n";
      $message.= "$settings[website_title]\n";
      $message.= "$settings[website_url]\n";

      mail($email,$lang['hl_t01'],$message,"From: $settings[website_title] <$settings[admin_email]>\nReply-to: $settings[admin_email]\nReturn-path: $settings[admin_email]\nContent-type: text/plain; charset=".$lang['enc']);
    }
    /* End of Notification posts to the visitor modification by Henrie >> part 1 of 4: Notification of normal post */
Part 2 of 4: Notification of post waiting for approval
Search for (lines 955-956)

Code: Select all

/* Let the first page know a new entry has been submitted for approval */ 
define('NOTICE',$lang['t85']);
Paste the following code directly before it on empty line 954.

Code: Select all

    /* Notification posts to the visitor modification by Henrie >> part 2 of 4: Notification of post waiting for approval */
    if (!(empty($email)) && $settings['notify_visitor'] == 1)
    {
      $char = array('.','@');
      $repl = array('.','@');
      $email=str_replace($repl,$char,$email);
      $message = sprintf($lang['t76'],$name)."\n\n";
      $message.= sprintf($lang['hl_t05'],$settings['gbook_title'])."\n\n";
      $message.= "$lang[hl_t03]\n";
      $message.= "$lang[t17] $name\n";
      $message.= "$lang[t18] $from\n";
      $message.= "$lang[t20] $email\n";
      $message.= "$lang[t19] $url\n";
      $message.= "$lang[t44]\n";
      $message.= "$comments_nosmileys\n\n";
      $message.= "$lang[t79]\n\n";
      $message.= "$settings[website_title]\n";
      $message.= "$settings[website_url]\n";

      mail($email,$lang['hl_t01'],$message,"From: $settings[website_title] <$settings[admin_email]>\nReply-to: $settings[admin_email]\nReturn-path: $settings[admin_email]\nContent-type: text/plain; charset=".$lang['enc']);
    }
    /* End of Notification posts to the visitor modification by Henrie >> part 2 of 4: Notification of post waiting for approval */
Part 3 of 4: Notification of approval/rejection
Search for (line 272)

Code: Select all

} // END approveEntry()
Paste the following code directly before it on empty line 271.

Code: Select all

	/* Notification posts to the visitor modification by Henrie >> part 3 of 4: Notification of approval/rejection */
	$myline = explode("\t",$addline);
	$email = $myline[2];
	
	if (!(empty($email)) && $settings['notify_visitor'] == 1)
    {
	  $char = array('.','@');
	  $repl = array('&#46;','&#64;');
	  $email=str_replace($repl,$char,$email);
	  $message = sprintf($lang['t76'],$name)."\n\n";
	  if (!$approve)
      {
        $message.= sprintf($lang['hl_t08'],$settings['gbook_title'])."\n\n";
      }
      else
      {
        $message.= sprintf($lang['hl_t07'],$settings['gbook_title'])."\n\n";
        $message.= "$lang[hl_t04]\n";
        $message.= "$settings[gbook_url]\n\n";
      }
      $message.= "$lang[t79]\n\n";
      $message.= "$settings[website_title]\n";
      $message.= "$settings[website_url]\n";

      mail($email,$lang['hl_t01'],$message,"From: $settings[website_title] <$settings[admin_email]>\nReply-to: $settings[admin_email]\nReturn-path: $settings[admin_email]\nContent-type: text/plain; charset=".$lang['enc']);
	  }
    /* End of Notification posts to the visitor modification by Henrie >> part 3 of 4: Notification of approval/rejection */
Part 4 of 4: Notification of approval/rejection
Search for (line 250)

Code: Select all

define('NOTICE',$lang['t87']);
Replace it with the following code

Code: Select all

    /* Notification posts to the visitor modification by Henrie >> part 4 of 4: Notification of approval/rejection */
    $addline = file_get_contents($file);
    /* End of Notification posts to the visitor modification by Henrie >> part 4 of 4: Notification of approval/rejection */
    define('NOTICE',$lang['t87']);
save and close the gbook.php file

Open the file settings.php
Find

Code: Select all

/* Notify visitor when you reply to his/her guestbook entry? 1 = YES, 0 = NO */ 
$settings['notify_visitor']=0;
and change it to

Code: Select all

/* Notify visitor when you reply to his/her guestbook entry? 1 = YES, 0 = NO */
/* This setting is also used for the Notification posts to the visitor modification by Henrie */
$settings['notify_visitor']=1;
Open the file language.inc.php
Add

Code: Select all

/* Language strings for modifications by Henrie */
$lang['hl_t01']='Thank you for signing my Guestbook.'; // E-mail subject
$lang['hl_t02']='Thank your for signing the %s Guestbook.'; // Text inside e-mail
$lang['hl_t03']='This is what you wrote:';
$lang['hl_t04']='Visit the below URL to view your message:';
$lang['hl_t05']='Thank your for signing the %s Guestbook. Your entry is waiting for approval and you will be notified when it has been approved.'; // Text inside e-mail
$lang['hl_t06']='Approval/rejection of your Guestbook entry'; // E-mail subject
$lang['hl_t07']='Your entry for the %s Guestbook has been approved.';
$lang['hl_t08']='Your entry for the %s Guestbook has been rejected.';
add it before ?>


Greetings,
Henrie

Posted: Wed Dec 30, 2009 9:08 pm
by jaap
Thanks Henrie, you are genious :D Works perfect.

I buy you a beer [ of een Buckler :lol: als je wilt ] tomorrow !

Jaap.

Posted: Thu Dec 31, 2009 8:39 am
by Henrie
I received your donation for a drink :D
Hartelijk bedankt (for those non-dutch reader: Thank you very much).
I will enjoy some extra drinks when celebrating new-year.

Happy New Year!

Henrie

Posted: Tue Mar 09, 2010 11:14 am
by donaldjeo
Hmmm.. nice code. i also use it for my site and its work. thanks to you for sending this code. its my pleasure that if you can give another code for editing. may be that ill easy against it... :wink:

Posted: Tue Mar 09, 2010 5:21 pm
by Henrie
Hello donaldjeo,

You are welcome :wink:

I am not sure what additional function you are asking. What would you like to edit?

Greetings,
Henrie

Re: Copy of post to visitor ?

Posted: Wed Jun 27, 2012 7:11 pm
by asaki
I have tried this modification in GB 1.7. I cannot get return msg that post is approved or rejected. Btw I think that in approval section part 2 of 4 should be:
$message.= sprintf($lang['hl_t05'],$settings['gbook_title'])."\n\n";
and not
$message.= sprintf($lang['hl_t04'],$settings['gbook_title'])."\n\n"

See language file:
$lang['hl_t04']='Visit the below URL to view your message:';

$lang['hl_t05']='Thank your for signing the %s Guestbook. Your entry is waiting for approval and you will be notified when it has been approved.'; // Text inside e-mail

Re: Copy of post to visitor ?

Posted: Thu Jan 17, 2013 3:35 pm
by Eduspin
I have the same issue as asaki, changed ['hl_t04'] in ['hl_t05'] as suggested and is an improvement already, but i still don't receive an e-mail when the message is approved or declined. Any suggestions would be appreciated.

Re: Copy of post to visitor ?

Posted: Thu Jan 17, 2013 9:10 pm
by Henrie
Somehow I overlooked Asaki's post. I changed ['hl_t04'] to ['hl_t05'] now in the approval section part 2 of 4.

@Eduspin
I am sorry, but i do not have time to look at the code now to check if it is working or not. I think I tested i thoroughly when I first wrote te code, so I think it should work.

Just to be sure i understand you right, you are talking about the visitor not receiving a mail when you have approved or disapporove the message of the visitor?

Greetings,
Henrie.

Re: Copy of post to visitor ?

Posted: Fri Jan 18, 2013 11:47 am
by Eduspin
Henrie wrote:Somehow I overlooked Asaki's post. I changed ['hl_t04'] to ['hl_t05'] now in the approval section part 2 of 4.

@Eduspin
I am sorry, but i do not have time to look at the code now to check if it is working or not. I think I tested i thoroughly when I first wrote te code, so I think it should work.

Just to be sure i understand you right, you are talking about the visitor not receiving a mail when you have approved or disapporove the message of the visitor?

Greetings,
Henrie.
Yes, you understand right. Thank you for your reply.
There is no hurry since i can manually send the approval for the time being.
The guestbook is at the moment at a testlocation at the server.
It is going to take a while before it's all as i like it.
When i reply a message the visitor gets an email about it, but not the approval or disapproval email.
Thanks.

Re: Copy of post to visitor ?

Posted: Mon Apr 22, 2013 8:18 pm
by Henrie
Hello Eduspin,

I finally had time to look into the issue of the notification mail of approval or rejection not being sent to the visitor.
I found the error and have to apologise to all who used the code in the past, because i think it may have never worked properly.
The error is in part 3 of 4. I used the following code

Code: Select all

    /* Notification posts to the visitor modification by Henrie >> part 3 of 4: Notification of approval/rejection */
    if (!(empty($email)) && $settings['notify_visitor'] == 1)
    {
      $char = array('.','@');
      $repl = array('.','@');
      $email=str_replace($repl,$char,$email);
      $message = sprintf($lang['t76'],$name)."\n\n";
      if (!$approve)
      {
        $message.= sprintf($lang['hl_t08'],$settings['gbook_title'])."\n\n";
      }
      else
      {
        $message.= sprintf($lang['hl_t07'],$settings['gbook_title'])."\n\n";
        $message.= "$lang[hl_t04]\n";
        $message.= "$settings[gbook_url]\n\n";
      }
      $message.= "$lang[t79]\n\n";
      $message.= "$settings[website_title]\n";
      $message.= "$settings[website_url]\n";

      mail($email,$lang['hl_t01'],$message,"From: $settings[website_title] <$settings[admin_email]>\nReply-to: $settings[admin_email]\nReturn-path: $settings[admin_email]\nContent-type: text/plain; charset=".$lang['enc']);
    }
    /* End of Notification posts to the visitor modification by Henrie >> part 3 of 4: Notification of approval/rejection */
The problem is that this code does not read the e-mail of the visitor properly and therefor can not sent the notification e-mail after approval or rejection to the visitor.
The following code should fix it, use it instead of the previously posted part 3 of 4.

Code: Select all

	/* Notification posts to the visitor modification by Henrie >> part 3 of 4: Notification of approval/rejection */
	$myline = explode("\t",$addline);
	$email = $myline[2];
	
	if (!(empty($email)) && $settings['notify_visitor'] == 1)
    {
	  $char = array('.','@');
	  $repl = array('&#46;','&#64;');
	  $email=str_replace($repl,$char,$email);
	  $message = sprintf($lang['t76'],$name)."\n\n";
	  if (!$approve)
      {
        $message.= sprintf($lang['hl_t08'],$settings['gbook_title'])."\n\n";
      }
      else
      {
        $message.= sprintf($lang['hl_t07'],$settings['gbook_title'])."\n\n";
        $message.= "$lang[hl_t04]\n";
        $message.= "$settings[gbook_url]\n\n";
      }
      $message.= "$lang[t79]\n\n";
      $message.= "$settings[website_title]\n";
      $message.= "$settings[website_url]\n";

      mail($email,$lang['hl_t01'],$message,"From: $settings[website_title] <$settings[admin_email]>\nReply-to: $settings[admin_email]\nReturn-path: $settings[admin_email]\nContent-type: text/plain; charset=".$lang['enc']);
	  }
    /* End of Notification posts to the visitor modification by Henrie >> part 3 of 4: Notification of approval/rejection */
I also applied this code to the original post viewtopic.php?p=12533#p12533 now.

It should work, but if you are having any issues with it, please let me know.

Greetings,
Henrie