notice: Undefined index: status in /modules/comment/comment.module on line 779.
notice: Undefined variable: status in /modules/comment/comment.module on line 857.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

julien’s picture

FileSize
78.55 KB

Hi,

I have reproduce this issue, and i have seen by a var_dump of $edit that two fields were missing in this array : $edit['mail'] and $edit['homepage'].
i have add a line before the query to add this two fields who are called by the sql query the next line.
To fix the second notice with $status, i check if the $status is set or not.

For $edit['mail'], i think we can set it up by a sql query who will get the email of this user by his uid. For the homepage, i don't know there is no field in the user table for it.

Hope this will help.

fwalch’s picture

You should create a patch instead of uploading the whole file. Read this handbook page to learn how to create patches for Drupal.

webernet’s picture

Status: Active » Needs review
FileSize
3.27 KB

Attached patch fixes the notices, as well as a code style (indenting) issue.

It also fixes what appears to be a bug: comments that have been approved are not returned to the moderation queue after being edited by a user without 'post comments without approval' permission.

webernet’s picture

FileSize
3.34 KB

Slightly faster and cleaner.

Freso’s picture

Status: Needs review » Needs work

It also fixes what appears to be a bug: comments that have been approved are not returned to the moderation queue after being edited by a user without 'post comments without approval' permission.

As much as I agree that this is a bug (even a possibly related one) and should be fixed ASAP, I'm still leaning towards having it filed as a separate issue with a separate patch. ("One fix per patch.")

webernet’s picture

Title: Notices when editing comments » Notices when editing comments & related comment moderation bug
Status: Needs work » Needs review

One of the notices is due to the missing status field in a query, therefore fixing it requires setting the status and, as a direct consequence, fixing the related bug.

Freso’s picture

Alright then.

I can reproduce the bug. Applying the patch (which happens cleanly) fixes it as advertised. I didn't test the moderation bug, thus not marking RTBC.

Gábor Hojtsy’s picture

Looks good, so once both bugs are tested against, I think this is ready to go.

Freso’s picture

Status: Needs review » Reviewed & tested by the community

I added a new user to the install, that only had permissions to access and post comments without approval. Before the patch, the user got notices after editing comments, and the already-approved comments were directly re-approved. After the patch, the notices are gone and the comment is put back into moderation. All in all, the patch works as advertised. :)

Marking RTBC per Gábor's comment.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)