dbosnj35 Posted May 18, 2021 Share Posted May 18, 2021 Hi, I need to prevent certain user or user group from logging in to WHMCS. I need the invoices to be sent to them every month so using the fake email address is not an option in order to prevent them to reset the password and then log in. I have a special product line and I must prevent them to log in the the cpanel. I can change the cpanel pass in whm but they can still change it from whmcs. So ideal for me would be to prevent them from login in to the whmsc. How can I do that? Thank you. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 18, 2021 Share Posted May 18, 2021 if you're using v8, then it would be UserLogin and you'd have to determine a list of users to check against. 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted June 2, 2021 Share Posted June 2, 2021 I think you have to do it the way @brian! explains it. You can't check against a client group as of WHMCS v8 because clients are not the same as users. A user can access one or more clients, but there's no group set for users - only clients. You can't access any client group with the "UserLogin" hook. Or, perhaps you can - but this is just a theory: When the user logs in, you need to find out what client that user is an owner of. That can be done like this: <?php use WHMCS\Database\Capsule; use WHMCS\Authentication\CurrentUser; $currentUser = new CurrentUser(); $user = $currentUser->user(); $clientId = Capsule::table('tblusers_clients') ->where('auth_user_id', $user->id) ->where('owner', 1) ->first(); Then, with the client ID in hand, your search tblclients for the client group for that client. If it matches, force the user to logout again. 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.