When I attempting to set a context filter on a panels layout (apply the layout to a specific group), I get a set of error messages. These are repeated when I attempt to view the page (the filter does not work).

Notice: Trying to get property of non-object in og_context_create_og_group() (line 199 of [drupal home]/sites/all/modules/og/og_context/og_context.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of [drupal home]/sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of [drupal home]/includes/entity.inc).
Notice: Trying to get property of non-object in og_context_create_og_group() (line 199 of [drupal home]/sites/all/modules/og/og_context/og_context.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of [drupal home]/sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of [drupal home]/includes/entity.inc).

This is happenning reproducibly on a fresh D7 install, with or without the following entities patch:

http://drupal.org/node/1220212#comment-5181770

Comments

amitaibu’s picture

Did you try with og -dev?

pav’s picture

Just tried it. Same result. I get to Selection rules >> Contexts, save my context (OG group, group ID = 1), click "Continue" and get

Notice: Trying to get property of non-object in og_context_create_og_group() (line 199 of [drupal home]/sites/all/modules/og/og_context/og_context.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of [drupal home]/sites/all/modules/entity/includes/entity.controller.inc).
Notice: Trying to get property of non-object in og_context_create_og_group() (line 199 of [drupal home]/sites/all/modules/og/og_context/og_context.module).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 184 of [drupal home]/sites/all/modules/entity/includes/entity.controller.inc).

...which is exactly what happens with the released version. (The error on line 354 appears when I view the resulting page.)

amitaibu’s picture

It seems that you somehow selected the og-context with "select" option, but didn't add a group ID. Can you remove and re-add that option again.

pav’s picture

Here's what's happening (reproducibly on different installs):

Home >> Administration >> Structure >> Pages and Variants >>[X Page Layout] >> Contexts:

In the "Contexts" section of the page I select "OG Group".

In the Add context “OG Group” popup I have the following:

Identifier: OG Group
Keyword: group
Enter the context type: Select an OG group
Enter a group ID: 1

(I've checked the "og" table in the database; I do have a group with gid = 1, etid = 1.)

When I click "Finish", the popup closes and everything looks great. Then, when I click "Update and Save" I get the above error message. The problem disappears when I delete the context and reappears when I re-enter it.

pav’s picture

An identical error surfaces when I try to set a context in Mini-panels.

amitaibu’s picture

Are you trying this on a clean installation?

pav’s picture

Yep. Just tried it on a completely fresh install with only the following enabled:

  • context
  • context layouts
  • context ui
  • ctools
  • page manager
  • entity api
  • og
  • og context
  • og ui
  • panels

Same result.

pav’s picture

I'm sorry, this is probably a daft question, but I can't find the answer in the documentation. What does hook_create_og_group actually do?

pav’s picture

I think, there might be a wider issue with contexts in page manager.

http://drupal.org/node/1330096

pav’s picture

I'm sorry, to be a pain, but I don't suppose you've had a chance to have a look at this? I've just updated to the latest version of the core, and I've got the latest dev versions of OG, panels and ctools, but no joy - still the same error message. This is a massive pain in the neck. I'm more or less clueless on the coding side, but I'd be happy to help with the testing.

VanD’s picture

I am having the same issue with 7.x-1.3

I get the error (warning) about 8 times per page load.

veades’s picture

Version: 7.x-1.3 » 7.x-2.0-alpha2

I found the same problem with 7.x-2.0.

I noticed in og_context 7.x-1.3 that og_context() returns an array with group_type and gid. And I was running into problems, because some og modules I was trying to use (og_theme and context_og) were trying to use the returned values from og_context() as an entity (or at least an object).

This might be the case with the modules you are using as well.

I am guessing some point in the past og_context() returned an entity object? And the external modules haven't adapted to the change.

Just a thought.

I got around the problem by writing my own version of og_theme module. I would be curious to know whether og_context will stick to returning array or if it will go (back?) to returning an entity? I see that og_context version 7.x-2.0-alpha2+59-dev is still using the array.

joelpittet’s picture

Status: Active » Closed (outdated)

Drupal 7 reached end-of-life and the D7 version of Organic Groups is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues. If you still have questions about using Organic Groups on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #og channel on Drupal Slack.

If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome! 💙

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.