Download & Extend

Relationship to Profile2 fields incorrectly joins on pid instead of uid

Project:Chaos tool suite (ctools)
Version:7.x-1.2
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:needs work

Issue Summary

When configuring a user view page using panels, selecting the fields from the profile2 entity joins the uid of the user profile page to the pid of the profile entity instead of the uid value.

For example: Say you have a user with id 4. And you have another user with uid 2. Each user has two profile entities associated to them.

uid 4 -> pid 3, pid 2
uid 2 -> pid 4, pid 1

When you load the panel user view using fields from the profile, user with uid 2 doesn't join on their own profiles. Instead loads the profile info from pid 2 (which belongs to uid 4) because the pids and uids are being mixed in the SQL.

I'll post a features export with an example setup to help debug.

The relationship between users and profiles seems to be generated using the foreign key relationship in he schema. So I'm not sure why/how the relationship is getting confused.

Comments

#1

Status:active» postponed (maintainer needs more info)

CTools does not contain any relationship code for profile2 -- that code would be provided by the profile2 module, I believe. However, it would be best if you specify exactly what configuration you're using in order to be certain. CTools does attempt to auto-generate entity relationships, and it *is* possible you're using an auto-generated relationship that is being created incorrectly, I suppose.

#2

Yeah that's what I had checked at first. I looked in Profile2 to see if it had any code which provided a relationship to the user (either directly, or some sort of hidden magic using the Entity API). Then I looked though Entity API and found nothing once again. The only thing I could find which dealt with generating a relationship was in CTools. I was skeptical that it was CTools since I figured someone else would have run into something similar by now but it's the only source I could find at the moment. The only link I could see coming from Profile2 was using the foreign keys in hook_schema which led me to CTools.

As mentioned, I'll get a features export submitted to test against. I just need to create a clean install and configure a simpler version of the original feature.

#3

If you tell me the exact name of the relationship I might be able to diagnose a little more just with that.

#4

I traced the relationship back to ctools_entity_from_schema_get_children() based on the text used to build the relationship in Panels.

I've attached a screenshot from Panels.

AttachmentSizeStatusTest resultOperations
Screen Shot 2012-10-27 at 11.32.49 AM.png39.81 KBIgnored: Check issue status.NoneNone

#5

Status:postponed (maintainer needs more info)» closed (cannot reproduce)

Since last week, I haven't been able to get the bug to reappear. I'll close this.

Thanks.

#6

Status:closed (cannot reproduce)» needs work

I got exactly same issue today, all latest dev version of ctools, panels and profile 2.

relationship is 'user profile from user (on profile.uid)

It takes the argument as PID instead of UID.

Any Idea?

Sorry for reopening this.

#7

Priority:normal» major

any update?

#8

I haven't seen the issue since. I've also switched to using a patch to Profile2 which fixes an issue with multiple profile types.

#1011370: Ctools relationship from user

http://drupal.org/files/1011370-profile2-ctools-54.patch

nobody click here