I'm having a Pager manager page with a user context. Additionally I added the relationship 'Profile from User (on profile.uid)' for retrieving the profile2 object.
Now when viewing the page, the wrong profile is loaded. Instead of using the UID to join on the profile.uid column, directly profile.pid is used, leading to the wrong profile object (the profile with pid = uid is loaded)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bambilicious’s picture

Subscribing.

mh86’s picture

The problem comes from the reverse relations in entity_from_schema contexts. It takes the UID from the user object and loads the profile2 with entity_load('profile2', array($uid)), which can't work, as the profile ID is needed instead. Of course the other way round - using the UID from the profile entity to load the user - works.

bambilicious’s picture

Have you come up with any possible way to attack this problem?

mh86’s picture

I'm using #1301080: Generic entity from view relationship handler in the meanwhile, but I think it's rather a workaround for such a simple use case.

bambilicious’s picture

Thanks, I'll have a look.

scottsawyer’s picture

Has anyone tested the patch?

I have 2 Profile2 types "Main", "company". I would like to have a context for each and selection rule based on they profile type. However, I can only seem to get the Main profile type to respond to my Panel.

Thoughts?

nagiek’s picture

Can't we just write our own plugin? profile2_from_user? We'd have to adjust the form to specify the profile2 type you want loaded, and boom!

nagiek’s picture

.

nagiek’s picture

Here's the patch and the file for the new relationship. Just rename the file to .inc and place it in the plugins/relationships folder.

nagiek’s picture

Status: Active » Needs work

.

nagiek’s picture

Status: Needs work » Needs review
merlinofchaos’s picture

Profile2 is a module, not core; as such, the policy of CTools is to require this kind of support to either be in the module or in a glue module maintained by others. I am unable to accept maintenance of code like this. It takes ages just to keep up with changes in core, I am simply incapable of keeping up with changes in other code.

There are rare circumstances that I'll support modules directly, typically when it's not possible to put the code anywhere else, but this isn't one of them since these plugins are very portable and can live anywhere.

I highly recommend you submit this to profile2 and/or make a module. If you do make it a module and need help getting through the review process to get approved git access, I can try to use a little of my community karma to speed things up.

wjaspers’s picture

Project: Chaos Tool Suite (ctools) » Profile2
Version: 7.x-1.x-dev »

Moving to correct queue.

pwaterz’s picture

The patch above didn't add the ctool plugin hook. Here is an updated patch

andypost’s picture

#14 is a part of #1011370-21: Ctools relationship from user
Suppose we need to mark this issue as duplicate

andypost’s picture

Status: Needs review » Closed (duplicate)
zmove’s picture

Status: Closed (duplicate) » Reviewed & tested by the community

Reopen because that's not the same issue. The profile2 module just need to have the relationship defined as the patch provide and this patch fix it.

fago’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
zmove’s picture

Status: Closed (duplicate) » Needs review

Not sure it's a duplicate. In that case it create the relationship from user (profile2_from_user.inc), in the linked issue it's from node (profile2_from_node.inc).

I reoped just to have confirmation it's a duplicate. If it's different issues, I can confirm that the patch in #14 works like a charm.

fago’s picture

Status: Needs review » Closed (duplicate)

True sry, still we have #1011370: Ctools relationship from user - let's track this over there.

andypost’s picture

@zmove Relation to profile from node should be build with relation from user from node, so @fago is right - let's focus on #1011370: Ctools relationship from user

zmove’s picture

@fago @andypost Thank you for answers, I will follow that.

operations’s picture

Patch #14 works and solved my problem (profile2 fields not working well with panels).

Achille’s picture

So, at this time, there is NO solution to this problem, correct?

Thanks

operations’s picture

As far as I think :)

druvision’s picture

#14 works for us, so I am repackaging the fix in this post.
- The 1st file is a new file under ctools/plugins/relationships/profile2_from_user.inc which should be run from the ctools directory.
- The 2nd file is a patch to profile2.module.

druvision’s picture

This is the 1st file from comment #26 (added ctools plugin), in a patch format

druvision’s picture

This is the 2nd file from comment #26, in a patch format (function added to profile2.module)

ledom’s picture

Issue summary: View changes
Status: Closed (duplicate) » Active

Reopen, duplicates not solved this issue.
I try dev version, which solved #1011370 but still need to add inc file from #14 to get profile2 fields showing into panel (if not, no context from profile2)
After each upgrade, I lose this file...

kenorb’s picture

Status: Active » Needs review
kenorb’s picture

Project: Profile2 » Profile 2
Version: » 7.x-1.x-dev
MorinLuc0’s picture

Status: Needs review » Reviewed & tested by the community

Been reviewed and from what I can see it has been applied already to the dev branch, Just waiting on a new release once 2227945 has been fixed it can be marked as closed.

The last submitted patch, 14: ctools-profile2_from_user-1273026-10.patch, failed testing.

The last submitted patch, 26: ctools-profile2_from_user-1273026-10.patch, failed testing.

The last submitted patch, 28: profile2.module.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: ctools-profile2_from_user.inc_.patch, failed testing.

mlncn’s picture

Status: Needs work » Fixed

As noted by MorinLuc0 this was applied to the dev branch and that is why the patch started failing. This is fixed.

Status: Fixed » Closed (fixed)

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