Jump to content

Custom login question


Guest benpotter1991

Recommended Posts

Guest benpotter1991

Hi there,

For a few weeks I have been developing a system for my website to manage users with domain/hosting products. However I have recently decided to integrate this with WHMCS.

I wish to continue using my custom login/logout pages and so far have successfully managed to set up hooks so that

- (using my custom login page) when a user logs in they are logged into their WHMCS account.

- when a user logs out they are logged out of WHMCS and redirected to my custom log out page.

 

However I have a small issue which I could use a hand with.

 

When a user (who is not logged in) tries to access a WHMCS-page which requires the user to be logged in, the WHMCS-based login form is displayed. In this situation I would rather the user be somehow redirected to my custom login page.

 

Is there a way I can do this? I can't seem to find one myself.

I appreciate any help given!

- Ben

Link to comment
Share on other sites

Guest benpotter1991

I have actually figured out a way that suits what I need, not sure if its the best way but hey it works!

 

Right at the top of header.tpl I have the code

 

{php}
if ($this->_tpl_vars['loginpage'] == 1)
{
$redirect_to =  substr($this->_tpl_vars['SCRIPT_NAME'], 1);
header('location: https://site.com/customlogin.php?redirect=' . $redirect_to);
exit();
}
{/php}

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