Here is my code:
function THEME_preprocess_block(&$variables) {
$variables['user_profile'] = menu_get_object('user');
}
I print the field "name" using print $user_profile->name
, and I get the following error:
Notice: Trying to get property of non-object in include() (line 71 of SITE\sites\all\themes\parce\block--block--2.tpl.php).
I assumed $user_profile
was not an object and I tried print render($user_profile['name'])
, which returned me:
Fatal error: Cannot use object of type stdClass
What is going on? I checked the Drupal API reference, and menu_get_object()
should return me an object.