Documentation
IPS_DeleteUser
bool IPS_DeleteUser (string $User)
Parameters
| User | Name of the user (case-sensitive) |
Returns
If the function succeeds, it returns TRUE, otherwise FALSE.
Description
The function deletes the user User including the user's role assignments and permissions. The roles themselves are kept.
This function is only available for licenses that include the RBAC feature (Permission Control). Otherwise it fails with "This function is only available for licenses with the RBAC feature enabled!". The user limit of the license is not checked here, so users can be deleted even if there are more users than the license allows.
The currently logged in user (see IPS_GetLoggedInUser) must be an administrator, i.e. the @admin user or a user with the @admin role. Otherwise the function fails with "Administrator permissions are required for this action!".
If the user does not exist, the function fails with "User with name '…' does not exist". The @admin user cannot be modified; trying to do so fails with "User @admin cannot be modified!".
See also: IPS_CreateUser, IPS_UserExists
Example
if (IPS_UserExists('anna')) {
IPS_DeleteUser('anna');
}