BlackXS Posted February 2, 2019 Share Posted February 2, 2019 Hi guys, I have difficulties to achieve one thing I saw on another site that also has WHMCS. My clients can not register theirself at WHMCS without ordering, so when they make an order, they will create a WHMCS account (for this there is options in WHMCS Config so i got this). Now I want to hide all the pages at WHMCS except for the ordering, the cart and of course products. So, first time when visitor go to mydomain.com/whmcs it says "Restricted Pages" but when he goes to product page, I want that he/she can see that page. Only hook I find on this site is forceeveryonetologin.php but unfortunately, this is not good, because in this case, the user(first time visitor) can not see all the pages including the product, cart because they have not been registered before. I hope that you understand me :) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 3, 2019 Share Posted February 3, 2019 19 hours ago, BlackXS said: Only hook I find on this site is forceeveryonetologin.php but unfortunately, this is not good, because in this case, the user(first time visitor) can not see all the pages including the product, cart because they have not been registered before. do you mean sentq hook from the thread below... if so, all you need to do is to expand the code to include additional pages that you want the customer to be able to see... <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function hook_ForceEveryoneToLogin($vars) { $client = Menu::context('client'); $validpages = array("login","dologin","clientarea","pwreset","cart","contact","index"); if (!$client && !in_array($vars['filename'],$validpages)) { header("Location: login.php"); exit; } } add_hook("ClientAreaPage", 1, "hook_ForceEveryoneToLogin"); index will show the homepage, and might be required too if you are offering MarketConnect products... 0 Quote Link to comment Share on other sites More sharing options...
BlackXS Posted February 3, 2019 Author Share Posted February 3, 2019 Hi @brian! That it's that hook from that topic I used. That's exactly what I needed, thank you very much, now it's just as I wanted to achieve. Kind regards! 0 Quote Link to comment Share on other sites More sharing options...
drenixweb Posted September 13, 2020 Share Posted September 13, 2020 I tried this code that works thanks! only one problem I use a theme which calls the pwreset page in this way: password-reset-change-prompt.tpl | password-reset-container.tpl etc. I can't seem to include it's page in the code so that it doesn't get locked. would there be a tip for this page 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 16, 2020 Share Posted September 16, 2020 On 13/09/2020 at 02:54, drenixweb said: only one problem I use a theme which calls the pwreset page in this way: password-reset-change-prompt.tpl | password-reset-container.tpl etc. I can't seem to include it's page in the code so that it doesn't get locked. would there be a tip for this page what you may need to do is a double check - e.g check for filenames (as currently written) and check for specific templates (e.g an array of your password templates) and then adjust the if statement to check both before redirecting. 0 Quote Link to comment Share on other sites More sharing options...
Kabir Posted February 27 Share Posted February 27 This hook works well, but for my use case I need something else. Essentially I want to show the products and cart but no other page other wise. The reason is that I have my own custom frontend (not built using whmcs templates) and I want to redirect the user to that custom page if that customer isn't logged in except in the case they want to see the products and subsequently the cart. Adding "index" in the valid pages also allows the user to see the login page of whmcs which I do not want. The user should only see my custom page which has the login, signup, e.t.c functionality already implemented. Can someone help with updating the above hook. Thanks in advance 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.