Jump to content

Disable user login to WHMSC


Recommended Posts

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.

Link to comment
Share on other sites

  • 3 weeks later...

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.

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