Jump to content

Login to cPanel & Webmail on Client Product Details


jpmaster

Recommended Posts

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

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

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!). :roll:

 

<?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.

Link to comment
Share on other sites

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!). :roll:

 

<?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

  • 3 weeks later...

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');
   }

});

Link to comment
Share on other sites

  • 2 years later...
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!). :roll:

 

 


<?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

  • 2 months later...
Guest
This topic is now closed to further replies.
×
×
  • 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