was in the middle of making a new post (not adding plugin or anything, just posting), then suddenly my admin panel became accessible returning the php error "unexpected T_string in wp-admin/user.php line 451"
// FINALLY, delete user
line 451: $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
wp_cache_delete($id, 'users');
wp_cache_delete($user->user_login, 'userlogins');
wp_cache_delete($user->user_email, 'useremail');
wp_cache_delete($user->user_nicename, 'userslugs');
I was puzzled and tried to search for this issue on forum, even though no exactly same problem is described, I found a similar thread and they explained that it might be a possible hack attempt. So I downloaded my user.php and compared with the original package, there's indeed an extra line of code just before line 451:
starting from line 443:
} else {
$reassign = (int) $reassign;
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
EXTRA LINE OF CODE: $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d2, $reassign, $id) );
}
My hosting company asked me to confirm in this place that this extra line of code is not generated automatically by wordpress/any plugins itself.
So, what's the real purpose of adding this extra line?
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d2, $reassign, $id) );