Jump to content

How to redirect back to same page after login


Recommended Posts

In my custom page, I have a check to see if user / client is logged in. If not, it links to the clientarea.php login page.

 

But how to send user back to my custompage once they've logged in?

 

For example:

 

Login here: mysite.com/clientlogin?&redirectto_custompage.php

 

 

Or - even better, how could I add a login popup modal on the custom page, which will allow them to login right there.

 

I've searched and searched and can't find any relevant information on this.

Link to comment
Share on other sites

Hi Brian

 

The custom page is a copy of serverstatus.tpl. It contains a bunch of divs with live server status information from an external 3rd party source (iframe). I would like the user to be logged in to view.

 

It's easy to link to the login page using {if !$loggedin} but of course that does not redirect the user back to my custom page.

 

I want to either have a popup login modal (similar to the top toolbar login popover) that would allow a login box on the page without redirect (Ajax?), or if not easy to do that, then send user to login page, then redirect back to the custom page once logged in.

 

I'm aware of hooks, I'm just not sure how to implement.

 

Thanks

Link to comment
Share on other sites

The custom page is a copy of serverstatus.tpl. It contains a bunch of divs with live server status information from an external 3rd party source (iframe). I would like the user to be logged in to view.

oh it's a custom template page ? I assumed you were using a custom php page with it's own template... if so, I think the solution would have been to put the redirection in the .php file, but to do it later in the template would be more long-winded.

Link to comment
Share on other sites

Thanks @brian!

 

That is probably the easier way to go - however, this is my first time making a new page and the instructions are not very clear.

 

Fine to create the "mypage.php" using their example, and with my custom content - and upload that to root whmcs directory - but this part has thrown me....

 

"Now when ready to test, upload the PHP file to the root WHMCS directory and the template file to your active template directory. Then visit the PHP file in your browser to try it."

 

Could you / someone shed any light on what it means by "the template file"? It's only mentioned the php file so far in the instruction - so I'm not clear what "other" template file I need to use...!

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