Disable creation of Vendor Admin

Hi,

Is there a way to disable vendors from creating new vendor admins on the vendor panel or alternatively, limit the number of admins they can create for their vendor store?

At the moment, when vendors log into their vendors panel, click on their profile > seller info> View vendor admins, they can create more vendor admins for their store

I would like to limit this number and base it on the pan they are using.

For an example, the standard plan for vendors to only be bale to create 2 vendor admins/users and the premium plan to allow up to 5 vendor admin/users.

Thanks

Hello

This is not out of box functionality. It is necessary to create an addon that will limit the possibility of creating admins for the vendor. Search the marketplace and if you don’t find it, we can write such an addon for you.

Best regards
Robert

1 Like

You can create a pre controller for the app/controllers/backend/profiles.php in your add-on, with a code similar to this one:

if ($mode == 'add') {
    if ($auth['user_type'] === UserTypes::VENDOR) {
        $total_company_admins = db_get_field(
            'SELECT COUNT(user_id) FROM ?:users WHERE company_id = ?i AND user_type = ?s',
            $auth['company_id'],
            UserTypes::VENDOR
        );
        if ($total_company_admins >= 5) {
            fn_set_notification('W', __('warning'), 'too many vendor admins');
            fn_redirect('profiles.manage&user_type=V');
        }
    }
}

You can implement additional logic and use language variables if you wish.