Firstly, check to see that
profile2_load_by_user is a function available via a .module file and not something you will need to load via
module_load_include() - which will load other files, such as .inc files.
Second, check the argument list for the preprocess hook. Did you define it as
&$variables and mistakenly assign it to
$vars which would mean nothing in this context? Did you forget to pass by reference via
& which makes the array modifiable?
Third, if you just added this code, clear your site caches so the changes are picked up.
Fourth, the function name isn't
preprocess_page. It should be