News:

Support the VirtueMart project and become a member

Main Menu

[SOLVED] Can't remove user in VM 4.2.6

Started by razor7, January 29, 2024, 19:53:02 PM

Previous topic - Next topic

razor7

Hi! reviewing code in User model I suggest this change, because if not, the $_JUser instance is null in line 1685 giving error Call to a member function delete() on null

This code should be changed...
                if (self::getSuperAdminCountS() <= 1) {
                    // Prevent deletion of the only Super Admin
                    //$_u = JUser::getInstance($userId);
                    $_JUser = JUser::getInstance($userId);
                    if (in_array(8,$_JUser->groups)) {
                        vmError('COM_VIRTUEMART_USER_ERR_LASTSUPERADMIN');
                        $_status = false;
                        continue;
                    }
                }

To this
                $_JUser = JUser::getInstance($userId);

                if (self::getSuperAdminCountS() <= 1) {
                    // Prevent deletion of the only Super Admin
                    //$_u = JUser::getInstance($userId);
                    if (in_array(8,$_JUser->groups)) {
                        vmError('COM_VIRTUEMART_USER_ERR_LASTSUPERADMIN');
                        $_status = false;
                        continue;
                    }
                }
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/