jpmaster Posted August 18, 2015 Share Posted August 18, 2015 Hello, We are using 6.0.1 and came to our attention that the links on the Clients Product Details to login to cPanel and Webmail do not work correctly. Where can we find those lines of code to correct them? We have looked around without luck all over the six template .tpl files. Thanks for your great help. Regards, Link to comment Share on other sites More sharing options...
brian! Posted August 18, 2015 Share Posted August 18, 2015 http://docs.whmcs.com/CPanel_Single_Sign-On#Customising_Single_Sign-On_Shortcuts Link to comment Share on other sites More sharing options...
jpmaster Posted August 18, 2015 Author Share Posted August 18, 2015 http://docs.whmcs.com/CPanel_Single_Sign-On#Customising_Single_Sign-On_Shortcuts Does not work. Still showing incorrect domain when trying to login to Webmail. Link to comment Share on other sites More sharing options...
brian! Posted August 18, 2015 Share Posted August 18, 2015 are you talking about the two links in the sidebar to cPanel and Webmail ? if so, these are no longer controlled via a template, but now need to be modified using an action hook. http://docs.whmcs.com/Client_Area_Sidebars_Cheatsheet Link to comment Share on other sites More sharing options...
jpmaster Posted August 21, 2015 Author Share Posted August 21, 2015 Thanks, this was of great help. Now, how can I link it to each domain? I have tried this code without luck: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://{$domain}/cpanel'); }); Link to comment Share on other sites More sharing options...
jpmaster Posted August 21, 2015 Author Share Posted August 21, 2015 Bah, When hiding the item from the sidebar it produces a blank page on any other client area page.... Too bad for WHMCS Link to comment Share on other sites More sharing options...
brian! Posted August 22, 2015 Share Posted August 22, 2015 try the hook below if you want to change the cpanel and webmail links.... it took me all afternoon to work this out (thanks to WHMCS and their lack of relevant documentation!). <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $service = Menu::context('service'); $domain = $service->domain; if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://'.$domain.'/cpanel'); $primarySidebar->getChild('Service Details Actions') ->getChild('Login to Webmail') ->setUri('http://'.$domain.'/webmail'); } }); obviously, because you're linking directly to these URLs, you can't use Single Sign-On - so the user will need to enter their username and password to log into cpanel/webmail. 2 Link to comment Share on other sites More sharing options...
jpmaster Posted August 26, 2015 Author Share Posted August 26, 2015 try the hook below if you want to change the cpanel and webmail links.... it took me all afternoon to work this out (thanks to WHMCS and their lack of relevant documentation!). <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $service = Menu::context('service'); $domain = $service->domain; if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://'.$domain.'/cpanel'); $primarySidebar->getChild('Service Details Actions') ->getChild('Login to Webmail') ->setUri('http://'.$domain.'/webmail'); } }); obviously, because you're linking directly to these URLs, you can't use Single Sign-On - so the user will need to enter their username and password to log into cpanel/webmail. Thanks for your great help. WHMCS really needs to have more relevant and accurate documentaton! It does not matter if the user has to type login info, what really matters is the user being taken where he/she needs to go! Link to comment Share on other sites More sharing options...
brian! Posted September 10, 2015 Share Posted September 10, 2015 I ran into an issue with this hook today - it works fine on a product linked to cPanel, but with other products it shows a blank page. with the assistance of sentq, I was able to tweak it to work correctly. <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $service = Menu::context('service'); $domain = $service->domain; $servertype = $service->product->servertype; # Not cPanel, no links added if ($servertype!="cpanel"){ return; } if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://'.$domain.'/cpanel'); $primarySidebar->getChild('Service Details Actions') ->getChild('Login to Webmail') ->setUri('http://'.$domain.'/webmail'); } }); 4 Link to comment Share on other sites More sharing options...
sha Posted January 26, 2018 Share Posted January 26, 2018 On 8/22/2015 at 10:29 PM, brian! said: try the hook below if you want to change the cpanel and webmail links.... it took me all afternoon to work this out (thanks to WHMCS and their lack of relevant documentation!). <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { $service = Menu::context('service'); $domain = $service->domain; if (!is_null($primarySidebar->getChild('Service Details Actions'))) { $primarySidebar->getChild('Service Details Actions') ->getChild('Login to cPanel') ->setUri('http://'.$domain.'/cpanel'); $primarySidebar->getChild('Service Details Actions') ->getChild('Login to Webmail') ->setUri('http://'.$domain.'/webmail'); } }); obviously, because you're linking directly to these URLs, you can't use Single Sign-On - so the user will need to enter their username and password to log into cpanel/webmail. You're a marvel! thank you very much Link to comment Share on other sites More sharing options...
Aqib2001 Posted April 8, 2018 Share Posted April 8, 2018 Thank you very much @brian! Link to comment Share on other sites More sharing options...
Recommended Posts