PDA

View Full Version : Email on subscribe - fetch_template and fetch_phrase not working


reflekt
10-10-2009, 11:29 PM
Hi,

I'm trying to send an email when a member purchases a subscription. I have created a plugin for the paidsub_build hook:

$message = fetch_template('subscription_email_onjoin_'.$subsc riptionid);
vbmail($user[email], "Thank you for your subscription!", $message, true);

I also tried:

eval('$emailmsg = "' . fetch_template('subscription_email_onjoin_'.$subsc riptionid) . '";');
vbmail($user[email], "Thank you for your subscription!", $emailmsg, true);

Having done extensive testing, I have narrowed the problem down to the fetch_template consistently returning a blank string. The template "subscription_email_onjoin_1" exists, and $subscriptionid definitely is returning "1". I have also tried using the cache_templates hook and writing a plugin with $globaltemplates[]='subscription_email_onjoin_1', no luck.

I've also tried using phrases (created them, linked them to the product with the dropdown that appears when you create the phrase) with no luck either.

$message = fetch_phrase('subscription_email_onjoin_'.$subscri ptionid, 1, '', false);
vbmail($user[email], "Thank you for your subscription!", $message, true);

For the life of me I cannot work out what the first two variables for fetch_phrase is meant to be. I have looked at everything!

* @param string Varname of the phrase to be fetched
* @param integer Phrase Type ID of the phrase to be fetched

There is no more documentation on what "Phrase Type ID of the phrase to be fetched" means that I can find. It's not the product id, it's nothing I can see on the phrase edit page itself either... help!


I have spent several hours googling for all variations of previously posted help on fetch_template, but no luck.

TIA for any help anyone can provide!