Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Feb 2011 at 22:02 UTC
Updated:
3 Jan 2014 at 02:58 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
fagoIndeed, we should improve the Views integration to offer a "Link to this entity" option.
Comment #2
roam2345 commentedStarted looking at this and have a working 'hack' followed the commerce module patterns.
Added this to the profile2.module
Added the profile2.views.inc file with
Still rather new to the module side of things but I think its a start.
Comment #3
munitras commentedWow. Just tried this real quick. Worked the charm -- thanks man.
Been barking up the wrong tree myself, thought it would need
instead of
thanks for this.
Comment #4
roam2345 commentedSo I added the missing join to have the relation ship work from the reverse way round ie. from users, and moved to views_data_alter to that I don't break the existing entities that were/are coming through.
profile2.module still has this at the bottom.
the new file profile2.views.inc changes to this
Comment #5
goldlilys commentedAdded this code, but still unsure how it's supposed to work. Is this supposed to show up when you have a field to display and there is a checkbox that says link to profile? Or other steps are needed for this to work?
Comment #6
roam2345 commentedIt adds a relation ship to a view ;)
Comment #7
fagofor the relationship, please test the patch from #1066398: Reverse entity relationships for Views integration
Comment #8
Herbt commentedAfter adding the code, I see the ability to list user id (unless that was already there and I hadn't noticed it). How would I go about using that to generate a linked list of user names?
My ideal would be for views to generate a linked list of users to their profiles based on tags, but I'll take anything at the moment. I actually get the results I need by building a custom content type. I like the way profile2 integrates into the user setup though.
Thanks
Comment #9
roam2345 commentedHey Herbt,
You should apply the entity api patch not the one I posed above.
- Then I assume you view is on a profile, then you would add the relation ship of user.
- After that you can pull what ever field off user you want.. ie (link to user page, as you wanted).
Comment #10
Wallace123455 commentedHello, I applied the code written by jucallme and it seems to be working. I can create a relationship "(Profile creator) User: Profile".
However, in my fields I still cannot find any field I can select which will have a link to the users profile page.
My ultimate goal is to create a view for the manager in an office to be able to link through the view to each employees profile page.
Am I doing something wrong? I feel like I am almost there, just don't know how to complete the final stretch.
Thanks
Comment #11
Wallace123455 commentedI think I figured it out. In my configuration of Profile2, I had "Provide a seperate page for editing" enabled under the profile type configuration page. Once I unchecked that, my Profile information is stored on the main user page. Therefore, it works.
Does anyone know how I can use this solution with the "Provide a seperate page for editing" enabled?
Thanks
Comment #12
roam2345 commentedPlease read #9
Comment #13
bjlewis2 commentedYou could also do it rather simply, using views. Follow these instructions for creating a contact link: http://drupal.org/node/1311706, only leave off the "/contact" and it should take you to the profile page.
Comment #14
fagoI think there is now a field "Rendered profile" in views once you have the latest entity api module installed, which has the display option to show just the entity label as link to the entity.