I have a User view with a VBO field. One of the available options is "Modify OG user roles" (og_user_roles_action).

Relationships are:
OG membership: OG membership from User
(OG membership from user) OG membership: Group Node from OG membership

When selecting users from the view and choosing the action, it results in:

Fatal error: Unsupported operand types in /var/www/sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.module on line 513

Looks like the form isn't able to be fetched from VBO.

The other forms seem to work fine.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstef’s picture

Looks like it's ending here:

function og_user_roles_action_form($context) {
  // Get the group type and group ID from the Views arguments.
  list($group_type, $gid) = $context['view']->args;

  if(empty($group_type) || empty($gid)) {
    return;
  }
mstef’s picture

Makes sense, given the way it's set up for the Group admin form. I wonder if we can generalize so it works in all Views (especially because it's available).

Probably not though, since a View showing all group memberships would contain multiple group types, and roles are group-type specific.

Thoughts?

amitaibu’s picture

Category: bug » support
Status: Active » Fixed

Checkout latest RC, there's an integration with OG-context, so it doesn't need to check for a specific argument :)

mstef’s picture

Version: 7.x-2.0-beta4 » 7.x-2.0-rc2

I got the version wrong on here.. I was running that, I just wasn't aware that it needed og_context to work properly.

Maybe the VBO description should make that clear so people don't run into this issue?

Thanks

mstef’s picture

Status: Fixed » Active

I'm actually still getting the same problem despite enabling og_context. Looks like $og_context isn't being populated. Maybe the view is missing something?

amitaibu’s picture

> Maybe the VBO description should make that clear so people don't run into this issue?

A patch would be nice :)

Og context is populated according to the Og-context handlers you have enabled, or if you are in a special URL, you will have to write your own OG-context handler.

askibinski’s picture

Did some debugging, in my case (using the og_context and og 2.0 stable) I found that indeed og_context doesn't get populated and the fallback for views argument gets called, but fails also

...
  elseif (empty($gid) || empty($group_type)) {
    // Get the group type and group ID from the Views arguments if they exist.
    list($group_type, $gid) = $context['view']->args;
...

This is how $context['view']->args looks like in my case:

...
Array
(
    [0] => 211
)
...

So the group_type seems to be missing?

askibinski’s picture

Version: 7.x-2.0-rc2 » 7.x-2.0
Category: support » bug

(changed category and version)

liquidcms’s picture

is it possible that vbo/actions and og are no longer compatible?

i have:
OG: 7.x-2.0+15-dev (2013-Mar-22)
Views: 7.x-3.6 (latest rel)
VBO: 7.x-3.1 (latest rel)

under Actions i have the configurable action "Modify OG user roles" but wheni try to create an action with this i get the error:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in system_actions_configure() (line 3097 of E:\wamp\www\boma\modules\system\system.admin.inc).

and no config form.

also, under a user view (as mentioned in original post) i have no actions listed under VBO that are related to OG.

liquidcms’s picture

hmm.. although i do see this action available under the Group/People tab of a group node - so possibly this is just not available as a generic action?

askibinski’s picture

Version: 7.x-2.0 » 7.x-2.3

Still got this error with OG-3.2 and VBO-3.1

My solution was to patch user_roles.action.inc:

..
   elseif (empty($gid) || empty($group_type)) {
     // Get the group type and group ID from the Views arguments if they exist.
-    list($group_type, $gid) = $context['view']->args;
+   list($gid) = $context['view']->args;
+   $group_type = 'node';
     if (empty($group_type) || empty($gid)) {
       return;
     }
..

Probably not the best because group_type is hardcoded ;)

drummondf’s picture

Subscribing to this - group admins have to have a way to manage group roles - I think this is high priority.

I'm in the same boat as everyone else re: versions, etc. Any news here?

EthanT’s picture

Creating patch file from comment 11 (it worked for me).

chris_h’s picture

Version: 7.x-2.3 » 7.x-2.x-dev
Status: Active » Reviewed & tested by the community

This still applies and works - would be great to get in place to stop the fatal.

fuzzy76’s picture

Status: Reviewed & tested by the community » Needs work

As #11 said, it hardcodes the group type. That will break stuff for some people.