Hello i have created one plugin to integrate the profile2 system for the new drupal 7
this is my first patch/addon, so please can anyone review it and probably add to ctool module.

With this module you can choose one of created profile types and display it on every page you want

currently it works only if you have not checked "Provide a separate page for editing profiles." in the profile settings

#57 profile2_panels_context.jpg76.79 KBCountzero
#54 1011370-profile2-ctools-54.patch6.55 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 53 pass(es).
[ View ]
#54 relations.png10.63 KBandypost
#54 profile_entity_api.png22.83 KBandypost
#54 profile_ctools.png27.16 KBandypost
#38 keyword duplicate a.jpg18.22 KBcalefilm
#38 profile 2 context b.jpg30.4 KBcalefilm
#21 1011370-profile2-ctools.patch6.4 KBandypost
PASSED: [[SimpleTest]]: [MySQL] 53 pass(es).
[ View ]
#17 profile2-ctools.patch6.38 KBandypost
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch profile2-ctools.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#11 user_profile2.txt2.51 KBericbroder
user_profile2.inc_.zip1.22 KBleonsio


Status:Needs review» Closed (won't fix)

profile2 is not a core feature. I assume it's a contrib module. It should provide the plugins. If the maintainer of profile2 does not want that, then a 3rd profile2_extras module or something should be created to offer these plugins.

With 5,000+ contrib modules and a robust API, CTools can't keep code for them.

Project:Chaos tool suite (ctools)» Profile 2
Component:Plugins system» Miscellaneous
Status:Closed (won't fix)» Needs review

Sending over to profile 2 -- maybe it's useful.

Note that CTools has a patch to handle at least some of the entity stuff automatically, and I don't know if that patch would end up superceding this stuff or not.

Title:Profile2 IntergationCtools integration

Probably it would. Also probably Ctools could make use of entity relationships that the entity API is aware of via hook_entity_property_info()? Then we'd get profile2 support too, as well as many others.

Doesn't work for me...
I uploaded it in sites/all/modules/profile2/plugins/content_types
I don't see any profile2 in all tab' s panel...
"Provide...." is not checked and i tried to uninstall "separate page" module but no results.

So what is the solution or the way to display some profile type in panels ? :-)


Thank you Leonsio.
Plugin works fine.

Same as andeim,
how to use it ?
Tried to integrate it in the profile2.info files[] but no sucess..

I'm also looking for the way to display some profile type in panels.

I tried to add a context for the profile type I created, it worked, but then this error shows up :
and there's nothing new in the content to be added related to profile.

* Notice : Undefined offset: 1 in ctools_context_create_entity() (line 80 dans (...)/public_html/sites/all/modules/ctools/plugins/contexts/entity.inc).
* Notice : Undefined offset: 1 in ctools_context_create_entity() (line 80 dans (...)/public_html/sites/all/modules/ctools/plugins/contexts/entity.inc).
* Notice : Undefined index: context_entity:profile2_type_1 in theme_ctools_context_list() (line 200 dans (...)/public_html/sites/all/modules/ctools/includes/context.theme.inc).

I also looked for a way to use the profile page /profile-artist_profile/1 (http://drupal.org/node/1074296) and insert it as a node, but I'm not quite sure this is a node actually... Can't find the nid, nothing shows up in the site content about the profile...

A nice work around which worked for me is to create a view of the type profile, with profile fields and create a view content pane display and add it to the panel page. It's appropriate I think as then I can control markup, labels and classes in views.


Component:Miscellaneous» Code
Status:Needs review» Needs work
new2.51 KB

Here's a txt version of the inc file in the original attachment. Looks like mostly a copy of plugins/content_types/user_context/user_profile.inc from ctools module. Definitely needs work.

Chaos Tools (CTools) Plugin Example module is useful for writing new plugins. For example:

Module setup and hooks

Your module must provide a few things so that your plugins can be found.

First, you need to implement hook_ctools_plugin_directory(). Here we're telling CTools that our plugins will be found in the module's directory in the plugins/<plugintype> directory. Context plugins will be in ctools_plugin_example/plugins/contexts, Content-type plugins will be in ctools_plugin_example/plugins/content_types.

function ctools_plugin_example_ctools_plugin_directory($module, $plugin) {
  if (
$module == 'ctools' && !empty($plugin)) {

I believe the patch mentioned in #2 was #1138708: Auto create "content-type" CTools plugins from tokens and was committed. So is this now resolved?

When I add the Relationship Profile from User (on profile.uid) to the panel context, the following error message is appearing:
An illegal choice has been detected. Please contact the site administrator.

If I ignore this and go on adding some content from the profile2 fields to the panel, I receive the error documented in this issue: http://drupal.org/node/1186702

No content is printed on the page.
When I use the customize this page button, I have many panes with that type of error :
Placeholder for empty "entity_field:profile2:field_subscriber_about_text will not display due to missing context"


Is there any quick solution to add a condition of Profile2 type when adding it as a Relationship in Panels "Contexts" tab?
Now there is common "entity_from_schema" relationship plugin used, but it takes profile2 object of random type.

Thanks a lot.

Suppose when adding relation there's should ability to choose a bundle to use for relation

EDIT: And big +1 to current patch

Category:feature» bug

Hope this is still coming along. An issue that is directly related to what a lot of us need #1100956: Profiles and Ctools/Panel integration issues has been closed and is redirecting us here, but this one seems kind of dead. Just want to encourage anyone who can help that this is needed. Thanks for all your hard work!

I personally think this is a bug since you can add profile2 fields to panels easily, they just don't show up. I'm marking it that way, feel free to change it though if I'm wrong.

Status:Needs work» Needs review
new6.38 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch profile2-ctools.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Patch introduces a content_type and relation from user plugins

I think this is minimal required integration.

1) having user in context now it's possible to add relation to a profile type and display separate fields

2) content type allows to display profile2 entity of selected type in different build modes

The only thing I thinking about to implement forms for editing, but still not found a good example....

Status:Needs review» Needs work

The last submitted patch, profile2-ctools.patch, failed testing.

Category:bug» feature

Status:Needs work» Needs review
new6.4 KB
PASSED: [[SimpleTest]]: [MySQL] 53 pass(es).
[ View ]

Standard patch with -p1

Status:Needs review» Needs work

The last submitted patch, 1011370-profile2-ctools.patch, failed testing.

Status:Needs work» Needs review

The test bot broken because dependency on entity module & seems OG


Care to address why this is a feature request and not a bug? If profile2 fields appear to be usable in panels but aren't I think that's a bug. I'm interested in your perspective.


>If profile2 fields appear to be usable in panels but aren't I think that's a bug.

Profile2 does not integrate with ctools yet. If something of profile2 appears there, I guess this is some generic integration provided by ctools. Thus you should file an issue over there.

for displaying a profile see #1325126: uninstallation troubles due to outdated entity info, what contains a patch for generic entity display. Please test it with profile2 and report there whether it works for you.

What maybe remains is a possibility to get the profile context from a user context. Or is that magically working via's Ctools foreign-keys schema-magic?

I'm on the rc1 of Entity, rc1 of ctools, and 3.0 of panels (stable) and 1.2 of profile2 (stable) - I can get some profile2 fields to now show up but they show the wrong user - in the panels context settings I have it set up to get the profile from the "user being viewed" however it shows some random user's information. It's a big step forward but I think it might be confused. Or I'm confused, but it's not working as expected :) I'm not sure what changed either, it might be when panels was updated recently but I'm not sure. I also got the current dev release of entity however that didn't change anything.

Reporting the same problem as elBradford. I'm using Display Suite with panels integration and the semi-recent releases of everything.

Jan 03 - Profile 2 v1.2
Jan 17 - Display Suite dev
Jan 18 - Panels v3.0
Jan 23 - Ctools dev
Feb 15th - Entity API dev

UID 1 shows the next lowest UID's profile information.
Every other user profile is completely blank.

I've tried all configurations imaginable, nothing seems to get it working. In one configuration I do get these warnings.

Notice: Undefined index: #profile2 in ds_extras_render_panel_layout() (line 934 of C:\xampp\htdocs\playground6\sites\all\modules\ds\modules\ds_extras\ds_extras.module).
EntityMalformedException: Missing bundle property on entity of type profile2. in entity_extract_ids() (line 7500 of C:\xampp\htdocs\playground6\includes\common.inc).

Not sure if that helps any.

I guess the Ctools user-profile2 relation is broken. To verify this is the problem, please try using the render-plugin with a profile2 specified by profile-id (!= user id).

The ctools relationship uses entity_from_schema.inc based on the fact that profile2 has a foreign key for uid. This relationship does not actually work to get a profile from a user because there is no profile id on the user entity, and there cannot be as there may be multiple profiles. We should get rid of this relationship in the interface since it doesn't work. Possibly we need to remove the foreign key from the schema?

The patch in #21 works well to add the relationship properly though.

Hi all,

I wrote a patch to get profile2 from a user context over at #1273026: Profile2 context from relationship doesn't work. Feel free to use it!

@nagiek Your patch should be marked as duplicate of this issue.
#21 already has the same implementation of relation plugin

#21: 1011370-profile2-ctools.patch queued for re-testing.

Did the test bot get stuck?

Status:Needs review» Needs work

We already have rendere-entity ctools support via the entity api, so no need to include this here. Another issue is the broken relationship. Still, couldn't we do the entity relationship easily via the entity api's property api + wrappers generically? I guess so, so let's better do that. (feel free to create an appropriate issue in the entity api queue and link it here)

I can't add much to the discussion here... other than to say that I tried the patch in #21 and it worked, but I still don't see the fields pop up in my substitution list... What gets me really frustrated.. Yesterday I didn't need to apply any patches. Everything worked fine! But I made some adjustments to my users and messed around with the content types.. then went back to the panel and all of a sudden the new profile's keywords weren't popping up in my substitution list.. and if selected individually in the pane, they don't appear. So am frustrated that it's not just automatically working like it was yesterday.

I had 7x-1.2 installed and 7.x-1.0-rc3 installed. Anyway, patch works, I can add the fields to my pane, but i cannot use any keyword substitutions in any custom pane..... like i could yesterday. So very confused. I almost thought I couldn't use Profile 2 anymore as I couldn't add any fields to my Panes! So without this patch can I not use Profile 2? Will the next version have this included? I'm a rather newbie so sorry for the questions but trying to pinpoint what I'm doing wrong.. or right at this point so i can use this module.

new30.4 KB
new18.22 KB

Just a quick update to my thread above regarding 'keywords': I found out that when I install Entity Tokens along with Entity API i get duplicates in my keyword substitutions list (so they do appear in the list--just don't work). As I stated before, I had this working without the patch in #21.. but now when I add keywords from my substituions list in custom panes they don't appear. So just for my own notes: I can't use Keywords in custom panes but if I use patch in #21 I can add fields to pane just fine. Don't understand duplicate issue so I will disable entity tokens.

Suppose each of contexts should have own name

any updates for #21: 1011370-profile2-ctools.patch being committed?

Edit: Just applied the patch, and while the relationship Profile from User (on profile.uid) now works, only fields on the first (lightest) profile type are displayed on the page. I can add fields from other profile types in panels, but no display.... Is there a patch for this?

Changes to profile2.module "@@ -781,3 +781,11 @@ function profile2_user_get_properties($account, array $options, $name) {" are not accurate in 1.2 or dev versions and removal causes WSOD.

Code starts on line 807 not 781 in 1.2 version and includes "$profile = profile2_load_by_user($account, substr($name, 8));"

function profile2_user_get_properties($account, array $options, $name) {
// Remove the leading 'profile_' from the property name to get the type name.
$profile = profile2_load_by_user($account, substr($name, 8));
return $profile ? $profile : NULL;

Cannot apply patch.

Applied the patch and it works but only for user 1 (admin).
Any fields from other users are not being displayed in mini panels, there are not even values retrieved for them. Verified by overriding the Title in the mini panel.

Profile Lite is an alternative that plays nicely with Panels.

Regarding the lack of field substitution tokens, from a glance at the debugger it seems that the Profile2 relationship (created from the patch in #21) utilizes the entity ctools plugin to attempt and generate a list of tokens (see ctools/plugins/contexts/entity.inc). However, when this plugin runs token_info(), no information about profile2 tokens is found. Perhaps this is because Profile2 doesn't implement hook_token_info(), so no token information is generated?

This make sense to anyone who knows the token system?

Because ctools has broken token support for now. See #1727804: Keywords substitution doesn't work as expected

Thanks andypost, although I think the confusion was mostly my own; apparently entity_token wasn't enabled on my project. Enabling them made the tokens available, although I'm experiencing calefilm's problem of duplicated tokens in the substitutions list (comment 38).

Without entity_token, the token substitution list is not generated and token keywords do not work.

Status:Needs work» Needs review

#21: 1011370-profile2-ctools.patch queued for re-testing.

Status:Needs review» Closed (duplicate)

Entity API 1.0 ships with the entity render plugin - so what's left is having the relationship to the profile entity. I still think this should be provided by the entity api module in a generic fashion

Anyway let's use the dedicated issue for tracking this: #1834920: Create profile2 ctools relationship context from node

Title:Ctools integrationCtools relationship from user
Status:Closed (duplicate)» Needs work

Realized #1834920: Create profile2 ctools relationship context from node is about relationships from nodes, re-opening this one.

Let's implement this in a general fashion in the entity api module: #1874006: Expose entity references as CTools relationships

Leaving this issue open as a reference and issue for discussions specific to profile2.

Status:Needs work» Needs review

#21: 1011370-profile2-ctools.patch queued for re-testing.

@fago I don't think that it's possible to introduce a generic relation here because we should choose a type of profile to relate else we get a multiple records. So both plugins uses a settings to choose a profile type

+++ b/plugins/content_types/profile2.inc
@@ -0,0 +1,134 @@
+  'defaults' => array('type' => 'main', 'build_mode' => 'account'),

Profile type is required here, so generic render does not work

+++ b/plugins/relationships/profile2.inc
@@ -0,0 +1,59 @@
+  'edit form' => 'profile2_from_user_settings_form',
+  'defaults' => array('type' => 'main'),

Same here

Suppose we should change a required context from deprecated "user" to "entity:user"

new27.16 KB
new22.83 KB
new10.63 KB
new6.55 KB
PASSED: [[SimpleTest]]: [MySQL] 53 pass(es).
[ View ]

Re-roll with #53 changes. tested locally.
The only trouble here that entity API adds another relation without pointing profile type

There's 2 relation types

Standard relation does not allows to choose a profile type

After patch - the second relation works as expected

We already expose per profile-type relations to the entity API, see profile2_entity_property_info_alter(). Once we let entity api expose this to ctools we should be fine.

The other relation stems from ctools itself which parses schema information. Not sure whether we can disable or overwrite this relationship.

makes sense. also we need a context/relation plugins to allow deeper relations to be attached

for example add relation to business profile and then add relation to company (node reference) from this profile

new76.79 KB

Excellent patch, but I get an error when saving (see attached screenshot : sorry for the french stuff).

I have two profile2 types, with one variant for each, selection rule based on respective roles. Everything works with the first, but not with the second.

I thank you a lot for your work on this. It's extremely useful for my use case (and probably for anything involving Panels and advanced user management).

Found this http://drupal.org/node/1257336#comment-5680366 when trying to search d.o for hints.

The issue (which originates from the same type of error message) seems to boil down to a problem with the global $user object, which is not a fully loaded one.

I guess you core coders are aware of this, but wanted to mention it just in case.

#54: 1011370-profile2-ctools-54.patch queued for re-testing.

Status:Needs review» Reviewed & tested by the community

#54 solves the problem. +1

I´ve just installed this patch (that seems to affect: ctools/plugins/content_types/profile2.inc, ctools/plugins/relationships/profile2.inc, and profile2/profile2.module).
I can confirm that it works and solves the problem.
I´ll keep testing it just in case it produces any errors, but it works.
Is it going to be committed?

Much needed here too! Would love to know when its committed .. subscribing ;)

Patch works WELL!!!!! Thank You!!!!!

I did have to have the dev version of entity API installed ;)

+1 for the patch in #54, it resolved a massive confusion I had trying to access the Profile2 data, good work! That said, I'll follow #1874006 to see what comes of the "correct" fix.

#54 Fixes it for me. Reviewed +1. Can we get it in please?

#54 works well for me too. Can you please commit?

#54 works well for me. There are many issues regarding this and got a bit confused about what was going on. But #54 works so I'll just go with it as of now. Thanks.

#54 works for me too.

#54 seems to work for rendered elements but not for field edit forms (like the profile owner wants to change the content of the fields.) Am I missing something or was the issue of the field edit forms not addressed in this thread?

@fago this patch lacks only form relation pligin, and because profile2 attaches only via extra field to user entity I see no other relation plugins able to solve the issue, ER does nothinh about standard profile2 setup.

See profile2_field_extra_fields()
1) forms profile2_form_user_profile_form_alter() & profile2_form_user_register_form_alter()
2) render profile2_user_view()

Does anyone have any ideas about #1965148: Load the full Panelizer default object? After applying the patch in #54 it works very well, but only on the user view (user_view at /user/%user). When editing any other panels, I can add the user context and this profile relationship but no fields become available to add.

Not sure what the state of #1874006: Expose entity references as CTools relationships is, but the patch in #54 works great.

The really confusing thing without this patch is that individual profile2 fields appear as ctools content in the admin UI, they just fail to work when viewing the saved panel.

Confirming that #54 works even with profile2-7.x-1.3. Let's get this patch committed, so you can close this 3 year old issue.

Issue summary:View changes

Is there a decision not to commit the patch from #54, over 1 year ago?

If so, is there another solution that has been committed in the meantime?


@jsibley: There has not been a decision to not commit the patch, there has just been no effort to maintain the project in almost a year.

Commit commit commit :-)

Status:Reviewed & tested by the community» Needs work

The relationship looks good, but we do not need the entity render plugin. Entity api already provides that generically. -> Needs work.

There is also a patch for #1874006: Expose entity references as CTools relationships which would provide the feature as well, but as noted there it provides worse UX. So adding this relationship here also would be fine with me.

ad #76: Yep, I had to less time to maintain profile2 properly recently as core eats up all my contribution time. Luckily, a co-maintainer has stepped up - see #2202231: Co-maintainership request.

Has the patch been commited please?

Issue tags:-profile2

@sketman: The issue's status of "needs work" indicates that it has not been committed.