I'm trying to associate a user's blog entry to a group if they so choose. So far, I've added Topics, and that's fine. But, I want the blog post to be added to a group activity if they tag an existing Group. Is this possible? I tried og_group_ref, but I only get error messages, and an HTTP 500 error.

Warning: array_shift(): The argument should be an array in commons_groups_tokens() (line 617 of /.../public_html/profiles/commons/modules/commons/commons_groups/commons_groups.module).

Is this possible?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcissimus’s picture

Looks like this happens when setting og_group_ref to max 1 value in field settings (typical if you want to have each node assigned to exactly one group via select list). Here's what fixed it in my system:

profiles/commons/modules/commons/commons_groups/commons_groups.module:

function commons_groups_tokens($type, $tokens, $data = array(), $options = array()) {
...
        // Return the title of the first group associated with this node.
        if (is_array($groups)) {
          $first_group = array_shift($groups);
        }
        else {
          $first_group = $groups;
        }

Would be nice if someone could create a patch for it. Thanks

matias’s picture

Status: Active » Needs review
FileSize
858 bytes

I have the same PHP warnings when the content is configured to only have one group.

This is marcissimus fix in a patch.