Add more user roles to a PHP logout redirect function [closed]

All you have to do is copy the part in the code that checks which role the user has and redirect somewhere else, like this:

function redirect_after_logout( $user_id ) {
    $current_user = get_user_by( 'id', $user_id );
    $role_name    = $current_user->roles[0];
    
    if( $role_name == 'administrator' ) {
        wp_safe_redirect( site_url( '/login/' ) );
        exit;
    }
    
    if( $role_name == 'ANOTHER_ROLE' ) {
        wp_safe_redirect( 'URL_WHERE_EVER_YOU_WANT_TO_REDIRECT' );
        exit;
    }
}
add_action( 'wp_logout', 'redirect_after_logout' );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)