Not sure if this is a content profile issue or a Ctools issue, but I'll start here. Move it if you'd like.

When creating a new Panel Page, with the context Logged in User, I try to add a relationship to the content_profile. When doing so, this error pops up:

Unable to complete operation. Fatal error in /sites/all/modules/ctools/includes/ on line 137: Call to undefined method stdClass::is_type()

When I look in, the is_type method is in class ctools_context, but the object doesn't seem to be of that class.

It does however work if I set the user context to a specifik user name.

Members fund testing for the Drupal project. Drupal Association Learn more


sdboyer’s picture

Project: Chaos tool suite (ctools) » Content Profile
Version: 6.x-1.3 » 6.x-1.x-dev
Component: Code » Panels integration

Sounds like a bug in content profile's relationship plugin. My guess is it's hard-coded to expect a uid, and may get confused when one isn't explicitly set.

molenick’s picture

I'm having a similar problem when trying to upgade to the newest version of CTools/Panels on a site. This site is using content_profile as well, although I'm not sure it's related in my case. Its also using og_panels, which is where I'm getting the problem from CTools.

The site upgrades cleanly without errors when I get the newest stable releases and install, but when I nav to:


I get:

Fatal error: Call to undefined method stdClass::is_type() in /var/aegir/platforms/dev/drupal-6.16/sites/all/modules/ctools/includes/ on line 137

I hacked CTools to output the object via print_r, and it is of type ctools_context. The is_type function is present in the class definition clear as day, but for some reason can't be found.

I won't bother to post the whole thing, but the object looks a bit like this when I add print_r($context) to line 137 of

ctools_context Object
    [type] => node
    [data] => stdClass Object
            [nid] => 4096

I feel like this is a CTools issue more than a content_profile one, but I could be wrong. Has anyone seen this problem on a site where content_profile isn't present?

tommyill’s picture

Same issue here, content_profile installed.

molenick’s picture

I did a little tracing on this and think the culprit was og_panels, which I didn't upgrade. When upgrading og_panels, ctools and panels in unison, this error disappears.

merlinofchaos’s picture

This is a tough one, because it's very difficult to tell where the broken context is actually coming from in that case.

Would it be possible to provide step-by-step instructions for getting to this error?

millaraj’s picture

I'm experiencing the same problem. I'm running drupal 6.16 with the latest versions of panels, ctools, og.

Basic steps from what I can see is...

1) Install og
2) Set up content types for group node and post
3) Create a new group
4) Create a new page
5) When that is complete, go to edit page and I get the following error

Fatal error: Call to undefined method stdClass::is_type() in /var/www/html/drupal-dev/modules/ctools/includes/ on line 137

dreadfulcode’s picture

The culprit is in content profile. I reproduced the exact same error creating contexts on a panel page, and I do not have OG or any of its submodules installed.

dreadfulcode’s picture

sboyer- "Sounds like a bug in content profile's relationship plugin. My guess is it's hard-coded to expect a uid, and may get confused when one isn't explicitly set."

Is there a workaround for this?

sdboyer’s picture

Well, until it's fixed in content_profile, you can either patch it yourself or write a new plugin with better logic, and use that one temporarily. Though you'd need to write an upgrade path to handle that. But "workaround" is kinda the opposite of "hardcoded" :(

tubby’s picture

i have the exact same issue :(

dreadfulcode’s picture

This is major. I am going to uninstall this on my dev site, because I was hoping to retrieve info from cck fields in content profile, info that was going to be displayed via contexts.

For example: Cck filed called: "My budget" A field intended to be visible only by the registered user.

I would then use the decimal from this field, and display in a custom pane. A number that can also be passed to a url link--made with custom php--- of which would then be an argument passed to an exposed filter on a views page. A page showing only the products under X budget. A nice twist in navigation, in combination with private information.

Having access to contexts in a pane this way would boost the value of panels and content profile modules, because of the easy manipulation and displaying of private data.

tubby’s picture

i'm not using the dev version but received the same error so posted last night. i updated all of my modules last night and that resolved the issue for me. everything is working fine now...WOO!

dreadfulcode’s picture

What modules did you update?? Do tell.

tubby’s picture

all of them :) i have quite a few so i'm not sure which update resolved the error. but basically, any mod that needed to updated got updated and given i hadn't updated in a while, was a good 10-15 that got updates. sorry, can't recall which.

thsutton’s picture

I did have this problem (though I don't have Content Profile installed, I believe it may have been installed at some point in the past on this site) and it was resolve by running `drush up` (presumably hitting `update.php` would have worked as well).

dspring0021’s picture

Does anyone know what the code fix would be for this and where to hack it? I am receiving the error as well. I recently upgraded to D6.19 and also updated all of my modules and ran luck. All modules are up-to-date. I can delete the panel in question and start new, but once I try to add a profile node relationship to the user context, I get this error again and then cannot access the panel (again). Any more advice is much appreciated.

davethedruper’s picture

I've been experiencing this same problem but it came right after I've uploaded the "uprofile" information from the Advanced Profile Kit. I'm a beginner at Drupal with only 6 months under my belt but if I was to draw any assumptions I would believe it would have to do with cTools-Content Profile and the importing of a new content type that brings this error. I'm kind of curious to see how many of you have APK and have imported the "uprofile" fields to Drupal.

wanovak’s picture

This will fix the problem though I'm not sure of the implications of doing this are. Pretty much Content Profile is passing an object of an unexpected type (if Content Profile exists in your contexts). I've solved this temporarily by doing the following:

if(get_class($context) != 'stdClass'){

// existing code within the foreach statement


So on unmodified code, you'll be inserting if(get_class($context) != 'stdClass'){ at line 138
and } at line 153

Once again, I haven't tested this. I only put this fix in to my code so I could access a Panel to modify its contents.

*Edit: this is in file: includes/
*Note: Modifying module code in this way is bad practice. I'm not suggesting you do this, but if you need access to one of your Panels, this works. Hopefully an update will roll out soon.

lucgiac’s picture

I. I have same problem. And I comment method is_type and it work. However, I dontknow it can cause other problems

davethedruper’s picture

Wanovak- Just wanted to say thank you for the fix! It's a little late but none the less still important.

boabjohn’s picture

Chiming in with the same error. I tried #18 but probably got the insertions wrong. Took me awhile to assume this is a hack on ctools/includes/

Is this right:

    // See which of these contexts are valid
    foreach ((array) $contexts as $cid => $context) {
      if ($context->is_type($this->keywords)) {

        // Compare to see if our contexts were met.
        if (!empty($this->restrictions) && !empty($context->restrictions)) {
          foreach ($this->restrictions as $key => $values) {
            // If we have a restriction, the cont

and to close:

        $result[$cid] = $context;


Thanks for any further help.

skat’s picture

I have the same problem that millaraj

davethedruper’s picture

Hello boabjohn,
First I just want to thank Wanovak for fixing this error and please see below for how I changed it that made it work, you can just copy and paste if you would like. This is from line 135-158:

// See which of these contexts are valid
foreach ((array) $contexts as $cid => $context) {
if(get_class($context) != 'stdClass') {
// Compare to see if our contexts were met.
if (!empty($this->restrictions) && !empty($context->restrictions)) {
foreach ($this->restrictions as $key => $values) {
// If we have a restriction, the context must either not have that
// restriction listed, which means we simply don't know what it is,
// or there must be an intersection of the restricted values on
// both sides.
if (!is_array($values)) {
$values = array($values);
if (!empty($context->restrictions[$key]) && !array_intersect($values, $context->restrictions[$key])) {
continue 2;
$result[$cid] = $context;

return $result;

idcm’s picture

@davethedruper and wanovak, I saw that ctools dev included the patch. I installed the dev version. Now the error occurs when I try to access panels context. I get the white screen of death and it shows the error:

Fatal error: Call to undefined method stdClass::is_type() in /sites/all/modules/ctools/includes/ on line 137

Originally the error occurred only when I tried to add a relationship.

I am not running OG, I noticed the issue after installing content profile along with CCK fields.

Back to the drawing board?

idcm’s picture

update - after returning to ctools 1.7, I still had the WSD. I uninstalled the content profile module and regained access to the panels context. So ... it seems like there is a connection between content profile and ctools.

idcm’s picture

okay, made one more attempt - I saw in an issue thread in panels that you if you have -dev for ctools, you have to have -dev for panels. I didn't realize that so it's no wonder my attempt to use -dev didn't work. Lesson learned ;-)

So ... I proceeded to patch by adding the lines noted in #18 - that did not work.
Then ... I proceeded to patch using the block of code from #23 - that did work. Apparently you need to remove
if ($context->is_type($this->keywords)) {

So, content profile is now working with panels context.

FYI - I am running D6.19 (patched), content_profile 1.0, ctools 1.7, and panels 3.7

thanks for all your help

idcm’s picture

I didn't notice if anyone had shared this ctool fix with the ctools issue queue so i posted one here

Sorry if this is a duplicate.

HongPong’s picture


fabsor’s picture

Status: Active » Needs review
2.12 KB


The problem seems to occur with new versions of ctools and when you haven't created a content profile node for your user when you enter the admin area.

This patch fixes that problem, at least for me.

Snipon’s picture

Alright, fabsor's patch seems to have solved the problem. Good work!
Happy times!

fago’s picture

Was there an ctools API change? Do we also need to bump the API version?

fabsor’s picture

I don't think we need to bump the API version. It seems to work fine with older versions as well. I tested back to Ctools 1.5.’s picture

+1 for patch #29

Hardly an edge case since site administrators will not have a profile node intended for end users for many applications of content profile.

geoffb’s picture

FWIW, I had the same Fatal error then I realized I hadn't created a content profile node for my user as pointed out by fabsor in post #29.

I disabled OG Panels, made sure the content profile node was set up correctly, re-enabled OG Panels and, pow, Fatal error when Editing OG Panels replaced by Panels goodness. Whew.

ayalon’s picture

Status: Needs review » Reviewed & tested by the community
1.57 KB

This patch is necessary if you create a user f.ex. via ubercart. Then there is no content profile and panels / ctools fails.

Attached an updated an tested patch rtbc.

LGLC’s picture

Patch #35 works for me - thanks!

jcre’s picture

I had the same error when i trying to create a panel page with a user context, selecting the logged in user and with a content profile relation. Create a profile for the admin solved the error.

lulyx’s picture

After I created a profile for the admin everything worked. thanks