I think this is the fix for it… change $user variable to $tmpuser (except the error)
function abpr_authenticateUser( $user, $username, $password ){
global $wpdb;
$tmpuser = get_userdatabylogin( $username );
$cap = $wpdb->prefix . "capabilities";
if ( $tmpuser != null && array_key_exists( ABSPRIVACY_ROLEREF, $tmpuser->$cap ) ) { //if the user's role is listed as "unapproved"
$user = new WP_Error( 'unapproved', __("<strong>ERROR</strong>: The administrator of this site must approve your account before you can login. You will be notified via email when it has been approved.") );
add_filter( 'shake_error_codes', 'abpr_add_error_code' ); //make the login box shake
remove_action( 'authenticate', 'wp_authenticate_username_password', 20 ); //prevent authentication of user
}
return $user;
}
I’ve tested it and it seems to be good….