CJF077 Posted October 3, 2018 Share Posted October 3, 2018 Hi Guys, I seem to have lost my touch, as we have not been using WHMCS for a while and things are a little chaotic. I need to do a few things. 1. Change the email template. Would like to restore it to the original, but cannot figure our the files or what was in the original email template header & footer. We have our old business name, and want to update it. 2. I need to edit the menu items. I want to point announcements, knowledgebase and support to an external helpdesk system. This I am presuming would need to be done in both the top menu, bottom menu, and of course once logged in. Any suggestions, on restoring me to sanity would be appreciated. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 3, 2018 Share Posted October 3, 2018 10 hours ago, CJF077 said: 1. Change the email template. Would like to restore it to the original, but cannot figure our the files or what was in the original email template header & footer. We have our old business name, and want to update it. they would have stored in the database tables - the individual email templates would be in tblemailtemplates; and the header/footer/css would be in tblconfiguration - so if you have old database backups, you should be able to recover them from there. 10 hours ago, CJF077 said: 2. I need to edit the menu items. I want to point announcements, knowledgebase and support to an external helpdesk system. This I am presuming would need to be done in both the top menu, bottom menu, and of course once logged in. difficult to answer without seeing what you're seeing... though if it's any recent version of WHMCS (e.g the last 3 years!), then you might be looking at using action hooks to modify the menu. https://docs.whmcs.com/Editing_Client_Area_Menus 10 hours ago, CJF077 said: Any suggestions, on restoring me to sanity would be appreciated. using hooks to modify the menus might send you over the edge... so sanity restoration might be above my skill set. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Jade D Posted October 3, 2018 Share Posted October 3, 2018 This may work to remove certain menu items Save into /includes/hooks/ <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->removeChild('Knowledgebase'); } }); The following allows you to add custom external links <?php #adding Menu Item to primaryNavbar use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $primaryNavbar->addChild('Support') ->setUri('https://za.domains/') ->setOrder(70); }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 3, 2018 Share Posted October 3, 2018 actually, what he probably wants is a combination of the two... e.g redirect existing links... <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setUri('https://google.com'); } }); but once we know what he's seeing, then the advice can be clearer! 0 Quote Link to comment Share on other sites More sharing options...
CJF077 Posted October 4, 2018 Author Share Posted October 4, 2018 18 hours ago, brian! said: they would have stored in the database tables - the individual email templates would be in tblemailtemplates; and the header/footer/css would be in tblconfiguration - so if you have old database backups, you should be able to recover them from there. difficult to answer without seeing what you're seeing... though if it's any recent version of WHMCS (e.g the last 3 years!), then you might be looking at using action hooks to modify the menu. https://docs.whmcs.com/Editing_Client_Area_Menus using hooks to modify the menus might send you over the edge... so sanity restoration might be above my skill set. 🙂 Unfortunately do not have a backup of the old template... so a copy of the original would be appreciated (email template) Yep the redirection is what is needed. Managed to do the knowledge base, but also need to redirect support in the menu. Have attached some screenshots of what I need changed. One is the main menu, not logged in. Other is side menu, when clicked on eg announcements Other is menu at top when logged in and side menu. Need to redirect them to two different URL's. Can we use one HOOK file to do all? 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted October 4, 2018 WHMCS Support Manager Share Posted October 4, 2018 1 hour ago, CJF077 said: Unfortunately do not have a backup of the old template... so a copy of the original would be appreciated (email template) In WHMCS 7.6 and above, you can find this data in the /resources/sql/install/tblemailtemplates.data.sql file. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 4, 2018 Share Posted October 4, 2018 6 hours ago, CJF077 said: Yep the redirection is what is needed. Managed to do the knowledge base, but also need to redirect support in the menu. Have attached some screenshots of what I need changed. i've posted the hooks to do all these things previously - though it would probably take me longer to find those links than it would to write the hook again! 7 hours ago, CJF077 said: Need to redirect them to two different URL's. specifically to this point, are you saying that the sidebar links need to be different based on whether the client is logged in or not... e.g if they're logged in, the Announcements links go to google.com; if they aren't logged in, they go to apple.com - or are they going to the same link regardless of whether they're logged in or not ?? 0 Quote Link to comment Share on other sites More sharing options...
CJF077 Posted October 4, 2018 Author Share Posted October 4, 2018 14 hours ago, WHMCS John said: In WHMCS 7.6 and above, you can find this data in the /resources/sql/install/tblemailtemplates.data.sql file. I dont believe that is it. I am referring to the info in General Settings >> Mail Global Email CSS Styling Client Email Header Content Client Email Footer Content 0 Quote Link to comment Share on other sites More sharing options...
CJF077 Posted October 4, 2018 Author Share Posted October 4, 2018 (edited) 7 hours ago, brian! said: i've posted the hooks to do all these things previously - though it would probably take me longer to find those links than it would to write the hook again specifically to this point, are you saying that the sidebar links need to be different based on whether the client is logged in or not... e.g if they're logged in, the Announcements links go to google.com; if they aren't logged in, they go to apple.com - or are they going to the same link regardless of whether they're logged in or not ?? Ill try and do a search for the hooks.... thanks for this. No the links will be the same for eg logging a support ticket, but the link for viewing may be different eg www.example.com/submitticket to www.example.com/viewticket Edited October 4, 2018 by CJF077 0 Quote Link to comment Share on other sites More sharing options...
CJF077 Posted October 5, 2018 Author Share Posted October 5, 2018 4 hours ago, CJF077 said: I dont believe that is it. I am referring to the info in General Settings >> Mail Global Email CSS Styling Client Email Header Content Client Email Footer Content Managed to find this in another thread. Fixed... Thanks for your help with this. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 5, 2018 Share Posted October 5, 2018 On 05/10/2018 at 04:47, CJF077 said: Managed to find this in another thread. Fixed... Thanks for your help with this. for the benefit of others reading this, it's in the docs. https://docs.whmcs.com/Email_Styling On 05/10/2018 at 00:37, CJF077 said: No the links will be the same for eg logging a support ticket, but the link for viewing may be different eg www.example.com/submitticket to www.example.com/viewticket I think that i'm slightly more confused now than I was in the first place. 🤕 let me give you a single hook file that changes all the links you want, and then if there are any required tweaks, you can get back to me... <?php # Menu/Sidebar Link Changes Hook for CJF077 # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setUri('https://google.com'); } if (!is_null($primaryNavbar->getChild('Announcements'))) { $primaryNavbar->getChild('Announcements') ->setUri('https://google.com'); } if (!is_null($primaryNavbar->getChild('Open Ticket'))) { $primaryNavbar->getChild('Open Ticket') ->setUri('https://google.com'); } if (is_null($primaryNavbar->getChild('Support'))) { return; } if (!is_null($primaryNavbar->getChild('Support')->getChild('Tickets'))) { $primaryNavbar->getChild('Support') ->getChild('Tickets') ->setUri('https://google.com'); } if (!is_null($primaryNavbar->getChild('Support')->getChild('Announcements'))) { $primaryNavbar->getChild('Support') ->getChild('Announcements') ->setUri('https://google.com'); } if (!is_null($primaryNavbar->getChild('Support')->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Support') ->getChild('Knowledgebase') ->setUri('https://google.com'); } }); add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (is_null($secondarySidebar->getChild('Support'))) { return; } if (!is_null($secondarySidebar->getChild('Support')->getChild('Support Tickets'))) { $secondarySidebar->getChild('Support') ->getChild('Support Tickets') ->setUri('https://google.com'); } if (!is_null($secondarySidebar->getChild('Support')->getChild('Announcements'))) { $secondarySidebar->getChild('Support') ->getChild('Announcements') ->setUri('https://google.com'); } if (!is_null($secondarySidebar->getChild('Support')->getChild('Knowledgebase'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setUri('https://google.com'); } if (!is_null($secondarySidebar->getChild('Support')->getChild('Open Ticket'))) { $secondarySidebar->getChild('Support') ->getChild('Open Ticket') ->setUri('https://google.com'); } }); function change_homeshortcuts_support_link_hook($vars) { return "<script>document.getElementById('btnGetSupport').href = 'https://www.google.com';</script>"; }; add_hook("ClientAreaFooterOutput",1,"change_homeshortcuts_support_link_hook"); to keep things simple, i've changed all the links to redirect to Google, so you can work your way through the hook and change them to more relevant links (those link URLs should be the only changes required to the hook). the first three navbar links are for non-logged in users. the support navbar links are for logged in users... i'm not specifically checking that the user is logged in because if they weren't, they wouldn't see these links! the four sidebar links will only be shown to logged in users - again, as that condition exists, we don't need to check if they're logged in... the last hook changes the link in the shortcuts menu. 1 Quote Link to comment Share on other sites More sharing options...
CJF077 Posted October 6, 2018 Author Share Posted October 6, 2018 Thanks Brian. Great work! did exactly what I needed / wanted... 0 Quote Link to comment Share on other sites More sharing options...
CJF077 Posted October 6, 2018 Author Share Posted October 6, 2018 Need a few more minor things. Hoping I can get some guidance Brian. On the email template that goes out, I want to add some info into a table next to the logo: Current Email header is this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset={$charset}" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <style type="text/css"> [EmailCSS] </style> </head> <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> <center> <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable"> <tr> <td align="center" valign="top" id="bodyCell"> <table border="0" cellpadding="0" cellspacing="0" id="templateContainer"> <tr> <td align="center" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader"> <tr> <td valign="top" class="headerContent"> <a href="{$company_domain}"> <img src="{$company_logo_url}" style="max-width:600px;padding:20px" id="headerImage" alt="{$company_name}" /> </td> </tr> </table> </td> </tr> <tr> <td align="center" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateBody"> <tr> <td valign="top" class="bodyContent"> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 6, 2018 Share Posted October 6, 2018 13 hours ago, CJF077 said: On the email template that goes out, I want to add some info into a table next to the logo: I guess the viability of that depends on your logo, it's size and required space needed for the table. at it's most basic, you could add text next to the logo... <img src="{$company_logo_url}" style="max-width:100px;padding:20px" id="headerImage" alt="{$company_name}" />hello world depending on what you've go in mind, another option would be to make an image banner, including your logo and text, and use that - that should remove the need to mess around with the css. 0 Quote Link to comment Share on other sites More sharing options...
Dean Walker Posted October 18, 2018 Share Posted October 18, 2018 Hi wondering if you can help me out, I tried following all of the above, I managed to get it working if logged in but for logged out users it would chuck them up with an oops page. I have done some debugging and put some code back in and no more errors but the hook is no longer changing the URL. can I pick your brains for a moment and take a look at the code I am using and point me in the right direction? All I am trying to achieve is to redirect the standard knowledge base article links in the menu / secondary menu etc to another URL Thanks <?php # Menu/Sidebar Link Changes Hook for CJF077 # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setURI('https://google.com'); } if (is_null($primaryNavbar->getChild('Support'))) { return; } if (!is_null($primaryNavbar->getChild('Support')->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Support') ->getChild('Knowledgebase') ->setURI('https://google.com'); } }); add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (is_null($secondarySidebar->getChild('Support'))) { return; } if (!is_null($secondarySidebar->getChild('Support')->getChild('Knowledgebase'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setURI('https://google.com'); } }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 19, 2018 Share Posted October 19, 2018 15 hours ago, Dean Walker said: I have done some debugging and put some code back in and no more errors but the hook is no longer changing the URL. can I pick your brains for a moment and take a look at the code I am using and point me in the right direction? All I am trying to achieve is to redirect the standard knowledge base article links in the menu / secondary menu etc to another URL there seems to be invalid characters all over your code - hopefully the following clean version should work for you (working locally)... <?php # Menu/Sidebar Link Changes Hook for Dean Walker # Written by brian! use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { if (!is_null($primaryNavbar->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Knowledgebase') ->setUri('https://google.com'); } if (is_null($primaryNavbar->getChild('Support'))) { return; } if (!is_null($primaryNavbar->getChild('Support')->getChild('Knowledgebase'))) { $primaryNavbar->getChild('Support') ->getChild('Knowledgebase') ->setUri('https://google.com'); } }); add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { if (is_null($secondarySidebar->getChild('Support'))) { return; } if (!is_null($secondarySidebar->getChild('Support')->getChild('Knowledgebase'))) { $secondarySidebar->getChild('Support') ->getChild('Knowledgebase') ->setUri('https://google.com'); } }); 1 Quote Link to comment Share on other sites More sharing options...
Dean Walker Posted October 20, 2018 Share Posted October 20, 2018 Hi Brian, Thanks for that, yes worked a treat! I have no idea why it had invalid characters! Again thanks for the help! 0 Quote Link to comment Share on other sites More sharing options...
GrandAdmiral Posted November 7, 2020 Share Posted November 7, 2020 This thread should be pinned somewhere, just saved me a heap of time trying to change out the support links. Thanks heaps Brian! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.