My context PHP reaction code doesn't fire.

After struggling with code, and after a look at other similar modules, i soved using function:
context_enabled_contexts
in place of:
context_active_contexts

in contextphp_reaction_php.inc file.

Please, can anyone verify if this issue is a bug fix?

Comments

Matt Habermehl’s picture

Yes, I had the same problem. Your suggested fix worked for me.

lahode’s picture

Wrong. If you user context_enabled_contexts, it will fire all the time, which seems logic.

The problem lies in contextphp.module

Replace the contextphp_init function by:

/**
 * Implementation of hook_context_page_reaction().
 */
function contextphp_context_page_reaction() {
  $map = context_condition_map();
  if (!empty($map['php']) && $plugin = context_get_plugin('condition', 'php')) {
    $plugin->execute($group);
  }
}

/**
 * Implementation of context_og_context_page_condition().
 */
function contextphp_context_page_condition() {
  $map = context_reactions();
  if (!empty($map['php']) && $plugin = context_get_plugin('reaction', 'php')) {
    $plugin->execute();
  }
}

Cheers

zmove’s picture

Issue summary: View changes
Status: Active » Reviewed & tested by the community

Before the patch, context PHP never triggered.

Now the conditions triggers.

However, I have a php notice :

Notice : Undefined variable: group dans contextphp_context_page_reaction() (ligne 57 dans /sites/all/modules/contextphp/contextphp.module).

which seems pretty logical as I don't see where the $group variable is defined.

Any patches to propose ?

zmove’s picture

Status: Reviewed & tested by the community » Needs work