1

As the title is kinda vague (couldn't for the life of me think of something more creative) here is the case.

I have an Entity Reference field on one of my Content Types that's limited to Users.

The field searched through the users via a dedicated view.

I've installed Profile 2 and added first and last names to the users of my site.

I've added all the view's fields as search parameters in the views settings (username, first name, last name, email) but only the username and email (core drupal 'fields') seem to be able to be searched for whereas the first and last name are the ones I need mostly.

Am I missing something?

1 Answer 1

1

I believe its because profiles are an entity unto themselves. So you are referencing users which means that if you want the profile fields to be searchable you will need to add a relationship in the view to User:Profile. Then use this relationship on the profile fields you want searchable.

Alternatively you could use entityreference to refer to the profiles directly from the content type.

3
  • I got the relationship set up else I wouldn't be able to show the fields themselves, which by default use that relationship. And it doesn't work. The alternate solution would complicated the content type too much sadly.
    – user5005
    Commented Aug 24, 2012 at 10:57
  • Yep, you are right, it really doesnt work! You could get all nutty and make hidden dummy fields on your user entity which are filled in by rules when a user updates their profile. That should work :)
    – 7wonders
    Commented Aug 24, 2012 at 11:15
  • yikes.. :S (more characters to fill the comment minimum)
    – user5005
    Commented Aug 24, 2012 at 11:39

Your Answer

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