charliedg Posted April 1, 2020 Share Posted April 1, 2020 Hello, I want to restric all pages to logged in users only, I found from a past post (I don't know If there is a better way to do it), a hook that works great, you can exclude any page from being blocked, but when users try to reset their lost password (from login form link that sends you to pwreset.php), after they submit their mail, the mail is sent to the user, but the confirmation page where says " Password Reset Requested etc. " is not redirecting correctly and shows me a redirecting error. I don't know which other file I must exclude or what should I do to work correctly, hope someone can help me. Thank you! The hook I'm using is: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function hook_ForceEveryoneToLogin($vars) { $clientID = intval($_SESSION['uid']); $adminID = intval($_SESSION['adminid']); if ($adminID===0){ if (!in_array($vars['filename'], array("login","dologin","clientarea","pwreset","register")) && $clientID===0){ header("Location: login.php"); exit; } } } add_hook("ClientAreaPage", 1, "hook_ForceEveryoneToLogin"); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 3, 2020 Share Posted April 3, 2020 using the hook in the thread below, I don't seem to be running into any similar issues with Six... possibly if this were a custom template, you may need to add the password reset templates into the list (though that would need a secondary list), but the big difference between my hook and the one you post is that mine includes index in the list of valid pages and depending on your friendly URL settings, that might solve the issue. 0 Quote Link to comment Share on other sites More sharing options...
charliedg Posted April 4, 2020 Author Share Posted April 4, 2020 Hello brian, thanks for your response! If I include index it works fine, but I also want to restrict homepage, and with index the homepage is accessible, the reason is that I'm creating my website on my main domain, and installed WHMCS on a subfolder, I just want to use it for client area. Any ideas are welcome, thanks for your help! 0 Quote Link to comment Share on other sites More sharing options...
weelow Posted April 6, 2020 Share Posted April 6, 2020 Just a curious question. Why would you want to do that? I mean it is nice to have the Knowledgebase pages accessible for seo for example. There is a preset for that in the general settings where you can prevent access to client area for users that are not logged in. Beyond that I think is too much. Its up to you ofcourse i just want to learn your reason and maybe find some use of it. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2020 Share Posted April 6, 2020 On 04/04/2020 at 19:38, charliedg said: If I include index it works fine, but I also want to restrict homepage, and with index the homepage is accessible, the reason is that I'm creating my website on my main domain, and installed WHMCS on a subfolder, I just want to use it for client area. I could easily fix it in the hook, but if the homepage is the only issue, then a simpler option might be to alter this through settings. in the admin area, if you go to setup -> general settings -> other -> Default to Client Area, then that will automatically redirect users from the homepage to the client area - which, if they're not already logged in, will be the login page. 0 Quote Link to comment Share on other sites More sharing options...
charliedg Posted April 6, 2020 Author Share Posted April 6, 2020 I missed that option !! Including "index" in the hook and redirecting homepage to login page from general settings is the solution! Thank you so much for your help Brian! Kind Regards! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted April 7, 2020 Share Posted April 7, 2020 22 hours ago, weelow said: I mean it is nice to have the Knowledgebase pages accessible for seo for example. Well, the SEO that KB provides is a quite poor. Probably it does more harm than good. It causes duplicated content and multi-language is based on session. In other words it doesn't matter how in how hard you translate articles. Search engines will "see" and index only the default language 😕 0 Quote Link to comment Share on other sites More sharing options...
weelow Posted April 7, 2020 Share Posted April 7, 2020 8 hours ago, Kian said: Well, the SEO that KB provides is a quite poor. Probably it does more harm than good. It causes duplicated content and multi-language is based on session. In other words it doesn't matter how in how hard you translate articles. Search engines will "see" and index only the default language 😕 It doesn't have to be that way. You can create fixed language urls with fixed language code in the generated URLs For example: Yourdomain.com/fr to generate html with fr-Fr Yourdomain.com/en to generate html with en-GB Using php routing or .haccess it can be accomplished You can even add a tag to the header that tells google that the website has different versions of itself with different languages and/or for different locals, hence geo targeting using search engine to display French website for france with euro currency and for Canada with Canadian currency. So much can be accomplished in this area with time and dedication. I recall that there are free geo hooks available. Take a look at them. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted April 7, 2020 Share Posted April 7, 2020 Of corse it can be fixed. I was referring to the fact that WHMCS doesn't support it right out of the box. 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.