This recipe works with the recipe "SHOW A FORM ONLY IF CERTAIN CRITERIA ARE MET" and requires the Website Membership plugin.
Linklok is an inexpensive program that I've used for quite a while to handle PayPal transaction verification and supply secure links for downloads (or web pages).
If you should decide to purchase linklok, or any other Vibralogic programs, I'd appreciate your using my affiliate link:
http://www.shareasale.com/r.cfm?B=12671&U=520135&M=3826
Thanks to a suggestion by Adrian Jones at Vibralogic.com, the company that created LinkLok PayPal, I used this code in their linklokipn.php file:
Search for Copy of Linklok Paypal and you should find this bit of code:
if ($CopyEmail != "") { $subject = "Copy of Linklok Paypal email sent to $payer_email for order $txn_id"; SendEmailOut($CopyEmail, $SellerEmail, $SellerCompany, $subject, $mailBody, $HTMLEmail); }
Change that code to:
if ($CopyEmail != "") { // $subject = "Copy of Linklok Paypal email sent to $payer_email for order $txn_id"; global $custom; if ($custom!="") $CopyEmail=urldecode($custom); SendEmailOut($CopyEmail, $SellerEmail, $SellerCompany, $subject, $mailBody, $HTMLEmail);
To use a Linklok custom download template which shows the email addresses that were sent, add the following code in linklokipn.php to create a “custom” variable:
Search For:
$buf = str_replace("!!!payment_date!!!", $payment_date, $buf);
and after that line, add:
$buf = str_replace("!!!custom!!!", $custom, $buf); // added to allow $custom email addresses to be shown in download email template
Then insert something like:
As you requested, download links have been emailed to: !!!custom!!!
in the Linklok custom download template where you want to show the email addresses.
CREATING A REPORT TO SHOW SENT EMAILS:
I wanted to be able to render a report for each customer (using the website membership plugin and based on which customer was logged in) that showed all the email addresses that they sent download links to.They needed to be displayed as both an email list and broken down by date.
The first thing that I did was to create 2 new text box fields in the accounts database. “Links Sent Emails Only” and “Links Sent Dates And Email”.
Then I inserted this code just before the PayPal button to update the account record of the person who was logged in to make the purchase with the emails entered for that transaction:
$custom2 = $_REQUEST['custom1']; $sent_dates_and_emails = date("m-j-y g:i:s a").': '.$custom2 .' * ' ; $sent_emails = $custom2 .', ' ; $query = "UPDATE `{$TABLE_PREFIX}accounts` SET links_sent_emails_only = CONCAT(links_sent_emails_only, '$sent_emails'), links_sent_dates_and_emails = CONCAT(links_sent_dates_and_emails, '$sent_dates_and_emails'), updatedByUserNum = '".mysql_escape( $CURRENT_USER['num'] )."', updatedDate = NOW() WHERE num = '".mysql_escape( $CURRENT_USER['num'] )."'"; mysql_query($query) or die("MySQL Error:\n". htmlspecialchars(mysql_error()) . "\n");
Then, in the report viewer, I used this code to render the 2 email lists:
At the top the login redirect
if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); }
And in the body:
<h3>EMAIL LIST (Complete)</h3> <?php echo ($CURRENT_USER['links_sent_emails_only']) ?> <hr /> <h3>EMAIL LIST (Broken Down By Date And Time)</h3> <?php $dates_and_emails = mysql_escape($CURRENT_USER['links_sent_dates_and_emails']) ; ?> <?PHP $dates_and_emails = preg_replace("[\*]i", "", $dates_and_emails ); ?> <?php echo $dates_and_emails ?> <hr /> <?php endif?>
|