1

Currently, I'm planning on using a text field for full names (added fields field_profile_full_name and field_profile_partner) on user entities, so that one user can link to another. However, I might not get matching entries in autocomplete (which rules out user references). What I want is this:

  1. A match to text entered in field_profile_partner is found in field_profile_full_name: return/use the text in field_profile_full_name.
  2. A match is not found: use the text the user entered in field_profile_partner, without creating a new user.

I know that a 'text or node reference' module exists for Drupal 6 and 7, but I've been unable to find a module that does the same thing for user references. Does such a module exist or will I have to clone and adapt 'text or node reference'? Can I configure entityreference to give me this functionality?

Note: I know that I could write a custom form and autocomplete page to handle this, but the functionality needs to be on the user account/registration form. If this can be done in hook_form_alter, please provide it as I've had no luck getting that hook to work whenever I implement it on anything.

1

The Entity reference module will relate any Drupal entities. These include:

  • Nodes
  • Users
  • Taxonomy Terms

So should be perfect for your needs.

| improve this answer | |
  • Thanks for the quick response. I've never used entity reference before, so this might be a stupid question. Will it allow me to create references to custom/add-on fields (not just core fields such as username)? – Agi Hammerthief Apr 17 '14 at 12:31
  • It allows you to create "entity reference fields". This field type can be added to any entity and it is this field that holds the relationship. So no, you can't use existing fields. – Felix Eve Apr 17 '14 at 12:38

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.