After installing, viewing any page managed by the module views I get the following error

Undefined variable: view_contains_nodes in permissions_by_term_views_post_execute.....

Comments

bettibio created an issue. See original summary.

dblade1975’s picture

Got the same issue. Tested 1.0 - 1.2

jepster_’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry, I cannot reproduce it. I was trying the same approach with PHP 5.6.7 and PHP 5.3.29. Please post at least the exact error output. Don't shorten it with dots at the end. So I can learn about the line and go to it. Which Drupal 7 version do you have? Are you on the latest one?

jepster_’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Closing this issue, because it cannot be reproduced.

dblade1975’s picture

Get this message after installing 1.0 - 1.2 and latest dev. Drupal 7.40

NOTICE: UNDEFINED VARIABLE: VIEW_CONTAINS_NODES IN PERMISSIONS_BY_TERM_VIEWS_POST_EXECUTE() (LINE 277 OF /HOME/DAVICKSE/PUBLIC_HTML/SITE/TAFFEL_DRUPAL/SITES/ALL/MODULES/PERMISSIONS_BY_TERM/PERMISSIONS_BY_TERM.MODULE).
NOTICE: UNDEFINED VARIABLE: VIEW_CONTAINS_NODES IN PERMISSIONS_BY_TERM_VIEWS_POST_EXECUTE() (LINE 277 OF /HOME/DAVICKSE/PUBLIC_HTML/SITE/TAFFEL_DRUPAL/SITES/ALL/MODULES/PERMISSIONS_BY_TERM/PERMISSIONS_BY_TERM.MODULE).

dblade1975’s picture

Status: Closed (works as designed) » Active
verblet’s picture

Problem is caused by $view_contains_nodes not being correctly initialised.

Update permissions_by_term.module (line 273) from:

  global $user;

  foreach ($view->result as $view_result) {
    if (array_key_exists('nid', $view_result) === TRUE) {
      $view_contains_nodes = TRUE;
    }
  }

to:

  global $user;

  $view_contains_nodes = FALSE;

  foreach ($view->result as $view_result) {
    if (array_key_exists('nid', $view_result) === TRUE) {
      $view_contains_nodes = TRUE;
    }
  }

I don't have the time to make a patch right now but hopefully this helps!

dblade1975’s picture

#7 solved it! Thanks!

  • 95041f2 committed on 7.x-1.x
    Issue #2560085 by bettibio: Fixed notice message on views page.
    
jepster_’s picture

Status: Active » Closed (fixed)

Thanks for the suggested code. I've fixed this in the latest bug fix release version 1.3 (https://www.drupal.org/node/2325357/release). Additionally it's part of the latest dev-version. Closing this issue.