Jump to content

Modify URL In Invoice Email & Reminders Sent From WHMCS


arkdata

Recommended Posts

Hi guys,

 

I've recently purchased a template that integrated WHMCS in the backend. My payment gateway also restricts payment transactions that originates from my main website http://www.arkdata.com.my . However, the Invoice email and reminders still have links that points to the original WHMCS install at portal.arkdata.com.my. Can we change the email template so that the URL reflects the correct URL at https://www.arkdata.com.my/client-area/ ?

Link to comment
Share on other sites

it can be easily done, you will create new file inside "/includes/hooks/" folder with this name "changeEmailTPLURLs.php" and put the following code inside it:

 

<?php

function hook_changeEmailTPLURL($vars){
   $mergeFields = array();
   $mergeFields["whmcs_url"] = "http://custom-url.com/";
return $mergeFields;
}
add_hook("EmailPreSend", 1, "hook_changeEmailTPLURL");
?>

this hook action will overwrite the {$whmcs_url} to the URL specified in here $mergeFields["whmcs_url"]

Link to comment
Share on other sites

it can be easily done, you will create new file inside "/includes/hooks/" folder with this name "changeEmailTPLURLs.php" and put the following code inside it:

 

<?php

function hook_changeEmailTPLURL($vars){
   $mergeFields = array();
   $mergeFields["whmcs_url"] = "http://custom-url.com/";
return $mergeFields;
}
add_hook("EmailPreSend", 1, "hook_changeEmailTPLURL");
?>

this hook action will overwrite the {$whmcs_url} to the URL specified in here $mergeFields["whmcs_url"]

 

Hi brian!, thanks for the suggestion, however, I'm not a programmer so I don't know how to use a Smarty.

 

Hi sentq, I just did your instructions. How is WHMCS able to know to run the hook for new invoice emails? Is it automated? I'll wait for the next automated invoice email sent to see if it works.

Edited by arkdata
Link to comment
Share on other sites

Hi brian!, thanks for the suggestion, however, I'm not a programmer so I don't know how to use a Smarty.

you just need to modify your email template(s) - invoice created and reminders - and replace {$invoice_link} with the code I gave you previously.

 

it was a copy & paste solution! :)

 

http://docs.whmcs.com/Email_Templates#Conditional_Displays

 

Hi sentq, I just did your instructions. How is WHMCS able to know to run the hook for new invoice emails? Is it automated?

if it works, it should do so automatically...

 

however, for your needs, it isn't suitable - in the invoice created/reminder emails, {$whmcs_url} isn't used - it's {$invoice_link} that is used and it creates a link to a specific invoice number.

 

in my opinion, the Smarty replace is the simplest solution.

Link to comment
Share on other sites

you just need to modify your email template(s) - invoice created and reminders - and replace {$invoice_link} with the code I gave you previously.

 

it was a copy & paste solution! :)

 

http://docs.whmcs.com/Email_Templates#Conditional_Displays

 

 

if it works, it should do so automatically...

 

however, for your needs, it isn't suitable - in the invoice created/reminder emails, {$whmcs_url} isn't used - it's {$invoice_link} that is used and it creates a link to a specific invoice number.

 

in my opinion, the Smarty replace is the simplest solution.

 

Hi brian!, looks like your solution is more suitable. Before I break my WHMCS installation is the below steps correct?

 

{$invoice_link|replace:'portal.arkdata.com.my':'www.arkdata.com.my/client-area'}

 

Setup -> Email Templates -> Invoice Created

 

[Original]

You can login to your client area to view and pay the invoice at {$invoice_link}

 

[Edited]

You can login to your client area to view and pay the invoice at {$invoice_link|replace:'portal.arkdata.com.my':'www.arkdata.com.my/client-area'}

Link to comment
Share on other sites

yes that's correct - do that and if you have a test account within your whmcs installation, send yourself an invoice created email and test the link.

 

the idea works as I tried your URL in my dev site and it worked fine, but you'll need to test to see if the modified link goes to the correct page on your wordpress site.

Link to comment
Share on other sites

perhaps the URL you're modifying it to isn't correct?

 

playing with my Dev site, I would imagine (obviously I can't test!) a link to one of your invoices would be along the lines of...

 

client-area/?ccce=viewinvoice.php?id=123

 

if that works directly for you in your browser, then perhaps the correct modification should be..

 

{$invoice_link|replace:'portal.arkdata.com.my/':'www.arkdata.com.my/client-area/?ccce='}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated