hi

I installed this module and it works ok, but when I have no comments in queue waiting for approval I have got this message warning:

warning: Invalid argument supplied for foreach() in /home/amwsp0/public_html/hallelujah/sites/all/modules/comment_moderation/comment_moderation.module on line 301.

It looks like a foreach loop doesn't have check for null/zero items in queue.

CommentFileSizeAuthor
#7 comment_moderation.patch623 bytestruyenle
#2 comment_moderation.patch352 bytescraigmc

Comments

tstackhouse’s picture

I ran into this bug as well, I just threw in a small edit on line 300 of comment_moderation.module to fix it.

I changed:

if ($form['#parameters'][2] == "approval") {

To read:

if ($form['#parameters'][2] == "approval" && is_array($form['operations'])) {

And that did the trick nicely. I'm not entirely certain how to make a patch, given my current setup, otherwise I'd submit one for this, I hope this helps out anyone and/or makes it into the next version of this module.

craigmc’s picture

Assigned: Unassigned » craigmc
Status: Active » Fixed
StatusFileSize
new352 bytes

Please find patch attached.

Status: Fixed » Closed (fixed)

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

hellaswebnews’s picture

thx. worked fine!

verta’s picture

Status: Closed (fixed) » Fixed

Could this be released from dev? 1.1 maybe?

David Lesieur’s picture

Status: Fixed » Needs review

It's not fixed until it has been committed...

truyenle’s picture

StatusFileSize
new623 bytes

I couldn't apply the patch from #2, I make another one for this.

Truyenle

manoloka’s picture

It did the trick for me ... wonder if this'll be commited sometime ?

Thanks great module

mudsurfer’s picture

I applied the patch in #7 manually to my site and it worked to solve this error.
Tks

u4umar’s picture

Easy Solution
Edit the file in any editor "comment_moderation.module"
Change in comment_moderation_form_alter(&$form, $form_state, $form_id) {

Replace this line "if ($form['#parameters'][2] == "approval") {"
with this "if ($form['#parameters'][2] == "approval" && is_array($form['operations'])) {"
and save.
The problem will be solved.

I have applied this in my drupal site. http://www.pepads.com

manoloka’s picture

mmm ... weird

When I did it the first time didn't solve my prob but it did this time ??? obviously I did something wrong that time.

Thanks