I have the following situation. A content type called cities holds all the cities in my country. A second content type holds all sales per city.

When a user logs in, I need him to see just some cities to which load sales. this means that a second user will see other cities.

How is this doable?

Regards, Martin


after adding the custom field to the user profile, i added a hook_form_alter() in seven theme template. (it should be added in administrative theme).

in this hook i read the user custom field using $user_full = user_load($user->uid)

setting global $user; is required to use $user in template.php

now i can modify other forms according to user custom field content

that's all

| improve this answer | |

ok, by going to Config > People > Account Settings > Manage Fields it is possible to add a field to the user profile.

Just make sure you check this option Display on user registration form.

the field type is set as Entity reference to the cities content type.

This allows the user profile to carry the country in the profile structure. Now i need to find a way to use this information elsewhere to filter them based on country.

| improve this answer | |

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.