Profile2 fields should be exposed to views.

CommentFileSizeAuthor
#1 986430_1_profile2_views.patch1.63 KBscor

Comments

scor’s picture

Status: Active » Needs review
StatusFileSize
new1.63 KB

This patch adds the profile table as a base table (which will automatically make views aware of all fields defined through profile2). It also defines a relationship to the users.uid column so that the regular Drupal user object can be integrated with a profile view.

meba’s picture

Will it really make Views aware of all fields defined? I just tested and it doesn't seem to offer me any Profile2 fields...

Core profile.views.inc in Views module manually processes all fields...

Anonymous’s picture

Anyone managed to solve this issue ?

aidanlis’s picture

Subscribe

bostonlatin’s picture

Has anyone found a solution to this issue? Thanks :)

joachim’s picture

Shouldn't Views on D7 automatically pick up anything that's got a hook_entity_info??

teh_catt’s picture

subscribe

Mamoun’s picture

subscribe

daften’s picture

subscribe

fago’s picture

Title: Views integration » Improve the views integration
Category: feature » bug
Status: Needs review » Active

Some general views integration has been added to the entity API, which also works forp profile2. See #965860: Add views integration. For making use of it, install the next dev snapshot of the entity API.

However, the entity API does not provide a relationship "user -> profile" for us - so we'll have to add this improvement in profile2.

scor’s picture

However, the entity API does not provide a relationship "user -> profile" for us - so we'll have to add this improvement in profile2.

correct, however the reverse relationship is available, profile -> user

scor’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tbenice’s picture

Category: bug » support
Status: Closed (fixed) » Active

I have the latest dev snapshots of profile2 and entity api installed and I get 'There are no relationships to add' for a profile or profile type view. I thought I can add a relationship to the user entity. What am I missing? Many thanks in advance.

hailu’s picture

+1

tbenice’s picture

Support for Profile2 seems to only be in the dev snapshot of views 7.x. I upgraded to dev and the relationships appeared.

pvsande’s picture

i tried using the dev views, but that didn't seem to work. My fields are still not showing in Views. Does anyone know how to resolve this?

joachim’s picture

@tbenice: which relationships?

tbenice’s picture

Hi,

I'm using 7.x-1.x-dev of profile2 and 7.x-3.x-dev of views. In my user view that show 'attendees' to an event, i use the user:profile relationship to show the user's full name and other info. I had been using the 7.x-3.0-alpha1 version of views and could not see any profile relationships available in user views and could not see user relationships available in profile views. I updated to 7.x-3.x-dev version of views (run update.php though I don't think there are db updates) and the profile relationships in my user view appeared. However, I still do not see user relationships in a profile view which is a separate issue and is being worked on here http://drupal.org/node/1043260.

I hope that helps!

joachim’s picture

Thanks for the feedback!

I'm afraid #1043260: Reverse relationship is not going to cut it here -- see my comment there.

joachim’s picture

I've started having a play around with this, and found that implementing hook_views_api() causes entity module to cease providing the basic Views support which was providing us with the profile->entity relationship... seems a shame :/

cnsmiles’s picture

Does this issue include the fact that you can't see term reference fields from profile2 under the Filter or contextual filter? Please let me know if I'm not the only one experiencing this ....spinning my wheels here.

BazzeFTW’s picture

It must be possible to use the fields in views, otherwise this module is just useless.

joachim’s picture

It looks like Entity API part of work on this is happening over at #1077148: add an entity-view row plugin.

cnsmiles’s picture

Well please test this. I created a view type of profile and did not see any of my profile fields values under filter which happen to be term referenced. All I see is reference to tid and delta. I also tested this with the user view type. I can pull them as fields but not under filter. I'm doing a profile2 based view. I know this works under the content views.

joachim’s picture

It looks like the piece that tells Views about fields is missing or broken. AFAIK this is something EntityAPI should be providing.

agence web coheractio’s picture

subscribe

joachim’s picture

Category: support » feature

This issue depends pretty much completely on:

- #1077148: add an entity-view row plugin
- #1111936: allow entity modules to extend the API's views support rather than clobber it

I encourage everyone following this issue to see whether they can help out over on those!

u8915055’s picture

subscribe

joachim’s picture

With the latest checkout of EntityAPI module, I get relationships both ways.

What are the missing pieces now? Can we make a list, so then we can split this off in to smaller issues?

I'll start:

1. The user -> profile relationship needs an option to limit by profile type(s). See #1114454: Views integration: create an entity-entity relationship that limits by entity type if applicable.

joachim’s picture

There's a patch over at #1114454: Views integration: create an entity-entity relationship that limits by entity type if applicable that maybe the many subscribers could help with?

davycw’s picture

subscribe

andrebonfanti’s picture

subscribe

joachim’s picture

Could people comment on #30 instead of just subscribing please?

What do we need apart from that other issue?

fago’s picture

see #1175662: improve auto-provided views generation for further improvements to-be-implemented in the entity API - help welcome!

sandwormblues’s picture

Issue tags: +undefined

Thanks for crunching this! Here's what i'm looking for as a front-end developer:

  • a list of user profiles, filtered by user role or by profile type, with custom fields viewable as a teaser (E.G. real name, occupation, profile pic), each list item linking to the full profile2 profile.
  • a "My Profile" menu item, as separate from the "My Account" item (currently, custom PHP is required to create the "user/XYZ/profile" url).
  • A "Resume format" view for profile would be nice; allow fields from users' profile to be formatted into something pretty that they would want to share with others / link to. (Attempting this with custom CSS class for views).
  • Integration with "contact" module to allow for embedded contact form in the profile.


    Is this already possible with profile2 and views or am i in fantasy land? It seems to me that this is useful if not critical functionality for an online profile.

    Happy to help any way i can.

sandwormblues’s picture

Oh yeah, one more feature/help request from the peanut gallery:

It would be fabulous if profile2 could automatically import user data fields. An explanation: I added a "Real Name" field to the account registration form and it would be great if stuff like that could automatically or semi-automatically migrate to the profile.

peas

joachim’s picture

Issue tags: -undefined

> It would be fabulous if profile2 could automatically import user data fields

That has nothing at all to do with this issue...

geerlingguy’s picture

Subscribe.

meabbasi’s picture

Subscribing.

joachim’s picture

awasson’s picture

I'm using the latest version of Profile2 with Views and Entity API.

Drupal 7.8
Entity API 7.x-1.0-beta10
Profile 2 7.x-1.0
Views 7.x-3.0-rc1

Am I to understand that the only way to create a view that lists out fields from a "Profile2" Profile Type with fields relating to the User account is to create a View of type: Profile and then create a relationship between Owner of the Profile ID and the User ID?

If so, that's great because it seems to be the only way that I can do this however we'll need to update the documentation to indicate that this is the case. I don't mind doing it and was going to add a page about it a few moments ago but I figured I had better check first.

Andrew

joachim’s picture

Please help test the patch I linked to in my last comment. It will provide what you need to go from user to profile.

fraweg’s picture

Hello, I am not realy understanding the situation at the moment. Is there a way to use profile2 filds in views?

Thank you for help!

Frank

AniaMi’s picture

I installed Profile2 module, so every user have Node Reference field and can have relationship with some content. How can I use user:uid in contextual filter - "User" is not visible at all, when I click "add" in contextual filters? How can I achieve this?
I want to have all content belonging to logged user (using this relationship - node reference)

I'm waiting for any help, because I have no idea how to do it.

Anna

flightrisk’s picture

Please tell me this kludge isn't the way this works. This really is unacceptable. It would be nice if just a few Drupal modules actually worked the way people did instead of some ridiculously complicated method only an experienced SQL programmer could use. You should be able to see profile2 fields on the same page by creating a user view as you due with all the other user fields.

frixos12’s picture

subscribing..

joachim’s picture

@flightrisk: Add the 'User: Profile' relationship to a user view. You will need the latest beta of Entity API to limit this by profile type.

@AniaMi: I see the contextual filter 'Profile: User uid' on a profile view.

In general: I'm no longer sure what this issue is requesting now. I suggest we close it and open new issues for any specific functionality relating to Views integration that is still missing.

fago’s picture

Status: Active » Fixed

In general: I'm no longer sure what this issue is requesting now. I suggest we close it and open new issues for any specific functionality relating to Views integration that is still missing.

Agreed!

flightrisk’s picture

Thank you, works! Though for what I need, to add a few fields that are hidden from the user that an admin or other supervisory role can edit, I don't see the difference in just adding the fields to the existing user account. I didn't know you could hide the fields based on role. So for example, I have certain users who are board members. I was going to give them a board member profile and may still, but if I just add "position" and "term expires", I can go into their account and just select "president" for position and "august 2012" for term expires and get everything I need from that with views. Maybe someone can tell me when profile 2 really shines. When I have several types of users and they need to edit their own custom profile details?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mvlabat’s picture

subscribed

mvlabat’s picture

Status: Closed (fixed) » Active
joachim’s picture

Status: Active » Closed (fixed)

Please see #48 above. If you have specific problems or requests to do with Views, please file a new issue (or look for an existing one which covers it).