SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Drupal 7.x and User Entity Referencing / View for Autocomplete?

    I'm using Drupal 7.x with the Entity Reference and Entity Connect modules. I have a Product Page content type that has 1 entity reference field that I'm trying to use to create user associations (i.e. - "Product A" might be associated with 2 users whereas "Product B" might be associated with 5, "Product C" only 1, etc., etc.)

    I didn't use a user reference field for this because the entity connect module wouldn't work with the standard user reference field type and since everything in Drupal is moving toward using entities anyway, I figured I might as well go with it. (I use entity connect for those moments when a user doesn't exist; it allows content editors who create Product Pages to create users on the fly if the reference doesn't exist).

    So from what I understood, users can be "entity referenced" because user profiles are entities themselves. This must be true because the field I'm using allows me to reference users by their username (i.e. - the auto-complete input of the entity reference field shows respective registered users when they're found) but what I need to do is reference users by their last name fields instead--which I'm having problems with.

    Think of all this as a "mask" for the auto-complete. That said, how does one reference users by another field in the auto-complete input??? Surely there's a way to do this because I can't imagine that you're locked into referencing only by username...

    With entity reference fields, you can attach a view to the field and I've read that this is how you can do all this... So I created a view that accepts a last name as a contextual field and made this view have the Entity Reference display. I then attached it to the field, but when I type a last name, well, nothing shows. So clearly, it doesn't work or else I did something wrong somewhere...

    (This is a hairy issue, I know, but I tried to keep it short. I posted a more verbose explanation of all this on a Drupal project page, too, which has more detail if necessary: http://drupal.org/node/1906344)

    Any insight into this is appreciated.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,018
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hey Casey,

    Have you tried the LinkedIn Drupal Groups? There are two I would check out the closed Drupal group (http://www.linkedin.com/groups?home=...ack=.gmr_35920). There are some pretty clever developers there.

    Andrew
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  3. #3
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, Andrew.

    No, I have not. But I will.
    (Didn't know about those groups--I guess LinkedIn is diversifying!)

  4. #4
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Update: Found this - http://drupal.org/node/1791914

    I guess this was all an issue coming from Entity Reference... The patch in #4 seemed to fix it but now I'm trying to get what the field keys off of to be displayed on the final node output (i.e. - it can now use the view to key from whatever field I tell it to but it's just not display that--instead, it's displaying the username). This will work if necessary, but it would just be *ideal* to show the First and Last name...

    Anyway, just wanted to give a heads-up here about the patch in case anyone seeing this has similar issues with Entity Reference and attaching views to said type of fields.
    Gotta love the OSS community. They make the world go round.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •