-5

How can i add all my users to a taxonomy term author so that when you start typing an author name it will suggest you names of all users with those letters?

3
  • 1
    Could you rewrite so we can understand it, I'm lost with what you wrote.
    – GwenM
    Jan 26, 2016 at 17:01
  • Change the question.
    – mamesaye
    Jan 26, 2016 at 17:18
  • 1
    You need to install Entity Reference module. And add am entity reference field instead of taxonomy term. Users are not taxonomy terms.
    – Elin Y.
    Jan 27, 2016 at 6:58

2 Answers 2

1

Use the entity Entity Reference Module.

  • Add a field with Entity Reference and a widget of Auto complete (tag style)

For example: I named mine lalala (click picture below to enlarge)

enter image description here

4) In your field settings:

  • Select User as your target type

enter image description here

After you click save field settings you are taken to another screen, scroll down and find Number of values and change it to Unlimited and Save Changes.

enter image description here

On your entity reference field since we are using Autocomplete (tag style) you start to type a user name and select the user. Then add a comma , to add more users

Ex: enter image description here

1

If i understand your question correctly, you can simply select all the users from users table and create a taxonomy term.
Ex. select * from users;
then use taxonomy_term_save() reference here to create a term.

And if you want to create a term for every user creation. use hook_user_insert() then create a term by taxonomy_term_save().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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