when i try to add comment, im having this warning:

warning: Invalid argument supplied for foreach() in /home/pinoybar/public_html/drupal/modules/ad_gallery/ad_gallery.theme.inc on line 28.
warning: Invalid argument supplied for foreach() in /home/pinoybar/public_html/drupal/modules/ad_gallery/ad_gallery.theme.inc on line 34.

Comments

maikeru’s picture

I think this is because in the theme function is trying to load the node based on args().

So it will work on paths such node/1 but not on somethimg like comment/reply/1.

It seems the $vars variable passes a node object, so in ad_gallery.theme.inc instead of node_load(args(1)), I just replaced it with:

$gallery = $vars['element']['#node'];

Edit: See #1061050: Node is retrieved from arg in preprocess function instead of get from $vars for patch.

tunic’s picture

Title: warning when i try to add comment on full node » warning: Invalid argument supplied for foreach() in ad_gallery.theme.inc when trying to add comment on full node view
Status: Active » Closed (duplicate)

As maikeru stated, this seems to be the same problem as #1061050: Node is retrieved from arg in preprocess function instead of get from $vars. Apply that patch and it should be ok. The patch includes the change that maikeru suggests plus another one related that solves a similar issue (using arg(0) instead of node directly).

I'm marking this bug as duplicate.