0

I have a vocabulary with parent-child terms. Every user is linked to a parent term in their profile field. And, I have CCK that the users fill in.

I need to add a Select Field with options as Child terms of a parent term that the User is linked to. (and save as term ref preferably) How do I achieve this?

Vocabulary: "Sites"
ONE
 -a
 -b
 -c
TWO
 -d
 -e
THREE
 -f
 -g

User1 => profile field term ref => "ONE"
User2 => profile field term ref => "TWO"

CCK type: "Study"
node/add/study  =>  select field (term ref) => "Select Site"
for User1 => Select site options => a, b, c
for User2 => Select site options => d, e
  • For this you can add a term reference field and use the full vocab. Then you will need to do a form alter hook in one of your custom module and filter out options based on logged in user. – Bharat Oct 24 '17 at 8:09
  • @Bharat, this solved my problem, thanks for the help! If you can add this as answer, I will be able to mark this post as answered. – Maddy Oct 24 '17 at 23:58
1

For this you can add a term reference field and use the full vocab. Then you will need to do a form alter hook in one of your custom module and filter out options based on logged in user.

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.