1

I have a taxonomy vocabulary "Partners", with boolean field field_1. When I create a user, I attach to it a term from the vocabulary "Partners" with an Entity Reference field. Is there a way to get the value of the field_1 field of that term and to bind it to the user?

(In the first case I need this value to limit the access to a page created by Page Manager to the users whose partners has the field_1 field filled with the value 1. I suppose I need the field value also for other cases later.)

The relation of the user and the partner could be made in another way, too, if it will be easier, more intuitive or more practical.

0

The user is already associated with the boolean field via the taxonomy term.

For example, load your user's account:

global $user;
$account = user_load($user->uid);

Now load your taxonomy term:

$partner = taxonomy_term_load($account->taxonomy_field_name[LANGUAGE_NONE][0]['tid']);

And then get the boolean value of field_1:

$boolean_value = $partner->field_1[LANGUAGE_NONE][0]['value'];
  • Thank you. As I am not a programmer, I'm not sure if I manage to handle this, but I'll try. – omun Apr 3 '14 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.