The module works all right, except when displaying context-aware statuses blocks in nodes associated to an organic group (og 7.x-2.0-beta2): the blocks won't be rendered and the following notice message comes up:

Notice: Undefined variable: status in access_stream() (line 301 of [...]/sites/all/modules/statuses/includes/utility/statuses.contexts.inc). =>

Having a look on the code, the problem seems to be a minor typo with the name of a variable. However after fixing the typo, the context-aware statuses blocks keep not coming up.
I attach a patch that solves the undefined variable message, but as I said something else needs to be taken care of regarding the blocks not been rendered ("statuses" and "statuses: conetex-sensitive stream" blocks).

Thanks!!

<blockquote>
diff --git a/includes/utility/statuses.contexts.inc b/includes/utility/statuses.contexts.inc
index 542a019..a89c55f 100644
--- a/includes/utility/statuses.contexts.inc
+++ b/includes/utility/statuses.contexts.inc
@@ -298,7 +298,7 @@ class statuses_og_context extends statuses_node_context {
         return parent::access_stream($recipient, $account) &&
           (og_is_member('node', $recipient->nid, 'user', $account) || $public_group);
       }
-      return parent::access_stream($status, $account);
+      return parent::access_stream($recipient, $account);
     }
   }
 }</blockquote>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oscardax’s picture

I attach here the patch with the correct file name...

oscardax’s picture

Re-reading the documentation and the code, I understand now that the og context will only trigger for the organic-group-node, but not for the rest of content-nodes within the group. This is true since the recipient-entity of the status is taken from the menu path (menu_get_objet()), which is the actual node being displayed. And later on with og_is_group().

(In includes/utility/statuses.contexts.inc)

  function is_applicable() {
    $g_ctx = og_context();
    return !empty($g_ctx) ||
      (!function_exists('og_get_group_ids') && arg(0) == 'node' && <strong>og_is_group</strong>('node', $this->find_recipient())); // OG 7.x-2.x: Don't fall back to Node context on private groups
  }
  function find_recipient() {
    $obj = <strong>menu_get_object</strong>();
    if (empty($obj) && is_numeric(arg(1))) {
      $obj = node_load(arg(1));
    }
    return $obj;
  }

At first I thought that the organic group context meant the user being 'wherever in the group', and not the user being exactly in the organic-group node.

If things have been designed to behave like this, there is nothing else to investigate regarding what I wrongly thought it was an error.

IceCreamYou’s picture

Status: Needs work » Fixed

Committed the variable name change to dev. Thanks.

You're correct that by default the OG context only applies on the group node. You can change this behavior if you'd like in the advanced settings of the context, although it might not behave as expected on pages that are not handled by default.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.