Jump to content
Hmmcrunchy

custom url for "login to control panel" button on each product

Recommended Posts

Hey folks 

is it possible to change the Log In To Control Panel button on the manage service page to a custom url ?

i have several products that aren't hosting but you do log in to manage them, i just need each of these products to go to a separate login page when you click "log on to control panel" where the user can then login ( the button doesn't have to log the person in they can do that manually) 

ideally the link would be on the same button (rather than in the side bar) to keep a standard way of accessing the CP for all products  

thanks :)

whmcs.png

Share this post


Link to post
Share on other sites

HI Dennis 

 

No module at the moment, or the software product doesn't have a module i should say.

Im just selling a product in WHMCS, and it would be really handy for clients to be able to go to the product and click that button to be taken to a login page for that product (even if they have to login) 

 

 

Share this post


Link to post
Share on other sites

Yes so the product would be a zero trust security product, a user would have to login to the control panel to admin it 

The site has no module available for whmcs but just would like a link for that product in whmcs  to go to the login panel for the product to save the client having to go Looking  - and it looks more professional 

if there were a module where we can just stick in a url to direct the button to that would suffice but most modules are specific provisioning modules that send data to one site 

Share this post


Link to post
Share on other sites

I'm just wondering why you have a "Login to Control Panel" button in the first place. This is the default template for products with no module:

billede.png.2fee192f8e49148c8d9b39b4cfb99afc.png

I've never seen or heard that a product automatically has any other buttons without being assigned a module.

Share this post


Link to post
Share on other sites

I suppose the question is can we put one there 

at this point i think any way of getting a link on a product page a client can click to go to the login page for that product even in the side bar

 

for a customer logging into whmcs to manage their products with us they click on the product then they have the option to cancel and ideally to go to login page.  rather than having the product but then having to go off to another page to try and find a login link which is not really user friendly 

whether its a button at the bottom, a generic module to allow this or a link in the action bar i dont mind 

 

below is an example screen we have 

 

image.thumb.png.63636ae0bec56d658fc402194f77ec9a.png

Share this post


Link to post
Share on other sites

Oh, I thought the screenshot from your original post was what you currently had. So just to be clear: You don't even have the "Login to Control Panel" button at the moment, or?

If not, you would need to build a very simple module. You basically just need to change how the client area pages are rendered. The relevant information can be found here: https://developers.whmcs.com/provisioning-modules/getting-started/

There's multiple ways to do it. One of them is to use the _ClientArea function to add additional code to the service page. It can be done like this:

<?php 

// other functions ...

function mymodule_ClientArea($params) {
	$code = '<a href="'.($params["serversecure"]=='on' ? 'https':'http').'://'.$params["serverhostname"].':'.$params["serverport"].'/login.php">Access Control Panel</a>;
	return $code;
}

First, it checks if the 'serversecure' parameter is set for the server added in WHMCS. If it is, it uses https, if not http. Then it adds the server's hostname, port and /login.php. A result could be https://mycontrolpanel.com:8080/login.php

You'd have to configure a server with the module in WHMCS for this to work - the positive side is that you can have multiple servers with their own hostname (and thus their own link to login).

Share this post


Link to post
Share on other sites

ok ill have to come back to this when i have some time. id hoped it would be quite and easy job 

 

thanks for your help 

Share this post


Link to post
Share on other sites

Here's a very rough example of how it could be done.
billede.png.977cbb254634d4219d375b8122329e6e.png

Extract the files to /modules/servers/.

You'll need to configure a server in WHMCS and select "Custom" as the module.
The HTML for the button is located inside /modules/servers/custom/templates/overview.tpl. In the custom_ClientArea function, you can change how the link is going to be rendered on the page.

custom.zip

Share this post


Link to post
Share on other sites
On 20/01/2023 at 9:47 PM, DennisHermannsen said:

Here's a very rough example of how it could be done.
billede.png.977cbb254634d4219d375b8122329e6e.png

Extract the files to /modules/servers/.

You'll need to configure a server in WHMCS and select "Custom" as the module.
The HTML for the button is located inside /modules/servers/custom/templates/overview.tpl. In the custom_ClientArea function, you can change how the link is going to be rendered on the page.

custom.zip 1.58 kB · 2 downloads

you absolute legend !!

 

That's exactly what I was looking for, thank you so much !

Share this post


Link to post
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