Jump to content

How to modify Login to cPanel button?


Aqib2001

Recommended Posts

6 hours ago, Aqib2001 said:

Hi, i wanted to modify login to cPanel button to add a remote login url in it

I had edited loginbuttons.tpl but it's not work

can you give a screenshot of where you are seeing this link/button - is it the sidebar?

DHuVCpz.png

 

Link to comment
Share on other sites

14 hours ago, brian! said:

can you give a screenshot of where you are seeing this link/button - is it the sidebar?

DHuVCpz.png

 

Yes, i wanted to change the login button present in the sidebar.

Now, i am using hook but it cause error on other pages

"Oops!

Something went wrong and we couldn't process your request.

Please go back to the previous page and try again."

Link to comment
Share on other sites

19 hours ago, Aqib2001 said:

If, i wanted to add a code of a remote login in cPanel that what should i do for that?

if you want to change the URL link for cPanel in the sidebar, just change the ->setUri('http://'.$domain.'/cpanel'); line in the hook...

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

23 hours ago, brian! said:

if you want to change the URL link for cPanel in the sidebar, just change the ->setUri('http://'.$domain.'/cpanel'); line in the hook...


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

});

 

Actually i wanted to add a form code and i wanted to set login to cpanel button as a form submit button. So, whenever user click on login to cPanel button he got automatically login.

My Reseller Hosting Provider Do not support singlesignon but i have remote login form.

Link to comment
Share on other sites

20 hours ago, Aqib2001 said:

Actually i wanted to add a form code and i wanted to set login to cpanel button as a form submit button. So, whenever user click on login to cPanel button he got automatically login.

did you want to add the form to an existing page, e.g productdetails - or to a sidebar ?

Link to comment
Share on other sites

8 hours ago, brian! said:

did you want to add the form to an existing page, e.g productdetails - or to a sidebar ?

Yes, i wanted to add a form in the sidebar and i want to replace login to cPanel button present in the sidebar with the submit button of form code.

Link to comment
Share on other sites

On 4/11/2018 at 23:03, Aqib2001 said:

Yes, i wanted to add a form in the sidebar and i want to replace login to cPanel button present in the sidebar with the submit button of form code.

you may have to add the buttons to a new sidebar and remove the cpanel/webmail links from the existing one, but it's certainly possible to do it.

lom8yMG.png

Link to comment
Share on other sites

17 hours ago, Aqib2001 said:

Can you guide me please?

copy the attached file to /includes/hooks/ and when a product uses a cPanel server, it should remove the two links from the actions sidebar and create a new sidebar with a form... :idea:

WJMbOQk.png

it should display using the current language choice...

m6MXoVA.png

you might need to tweak the code for your own needs - especially if you need to tweak the paths.

sidebarform.php

Link to comment
Share on other sites

6 minutes ago, brian! said:

copy the attached file to /includes/hooks/ and when a product uses a cPanel server, it should remove the two links from the actions sidebar and create a new sidebar with a form... :idea:

WJMbOQk.png

it should display using the current language choice...

m6MXoVA.png

you might need to tweak the code for your own needs - especially if you need to tweak the paths.

sidebarform.php

Ok, thank you so much :)

Link to comment
Share on other sites

  • 2 weeks later...
On 4/14/2018 at 4:22 PM, brian! said:

copy the attached file to /includes/hooks/ and when a product uses a cPanel server, it should remove the two links from the actions sidebar and create a new sidebar with a form... :idea:

WJMbOQk.png

it should display using the current language choice...

m6MXoVA.png

you might need to tweak the code for your own needs - especially if you need to tweak the paths.

sidebarform.php

I tried this but it's not working

Link to comment
Share on other sites

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