I added an array field with three possible values to the user. It is called field_user_school_category. I am using Drupal 7.
I want to extract the field value for the current user and use it in a page in an if statement (in php text format). I just can't get the extract code to work. I can't even get the value to print - see code below. What am I doing wrong?!
The field is currently set up to accept multiple values. (I know I need to probably loop through to extract any other values later on). I have also tried using $school['und']['safe_value'] instead of $school amongst a myriad other things.
Any ideas or help would be very gratefully received.
<?php global $user; $account = user_load($user>uid); $school = field_get_items('user', $account, 'field_user_school_category'); $schoolcat = field_view_value('user', $account, 'field_user_school_category', $school); print $schoolcat;