I'm on Drupal 7.22 and using Mollom 7.x-2.7 without any problems. Very recently I've added some webforms and went into Mollom Content Moderation with the intention of changing a few of my forms from text analysis to captcha.

Research has shown that this has come up in Mollom before but I can't see a fix.

I get a pink box at the top of the Mollom content moderation screen with the below notices.

Can anyone suggest a fix for this

Notice: Trying to get property of non-object in node_mollom_form_info() (line 3200 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Trying to get property of non-object in node_mollom_form_info() (line 3208 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Trying to get property of non-object in node_mollom_form_info() (line 3213 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Trying to get property of non-object in node_mollom_form_info() (line 3217 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: article in mollom_form_info_add_fields() (line 1006 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: blog in mollom_form_info_add_fields() (line 1006 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: page in mollom_form_info_add_fields() (line 1006 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: webform in mollom_form_info_add_fields() (line 1006 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).
Notice: Undefined index: forum in mollom_form_info_add_fields() (line 1006 of /nfs/c01/h14/mnt/12661/domains/in-cnc.com/html/sites/all/modules/mollom/mollom.module).

CommentFileSizeAuthor
#3 mollom.orphan-forms.3.patch4.65 KBsun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Didier Misson’s picture

I have the same problem on Drupal 7.23 and Mollom 7.x-2.7 ...

Thanks.
Didier

sun’s picture

Title: Notices on the Mollom Content Moderation page » Notice: Trying to get property of non-object in node_mollom_form_info()
Version: 7.x-2.7 » 7.x-2.x-dev
Component: Miscellaneous » Code
Category: support » bug

Sorry for the delay.

This notice appears, because one or more node/content types that previously existed, no longer exist. Most likely, because the content types were renamed or deleted.

As of now, the Mollom module does not have a mechanism for detecting the rename or deletion of a protected form. Thus, the configured forms are still the same, and it tries to retrieve information for the form that was previously protected.

Since it is borderline impossible to implement a generic mechanism for reacting to all renamed and deleted forms that may be provided by other modules (that integrate with Mollom), we should implement a mechanism to automatically remove stale/orphan form configurations.

And of course, the concrete offender of node_mollom_form_info() obviously needs to be adjusted to check whether the requested node type actually exists, before trying to operate further on it. :)

sun’s picture

Status: Active » Needs review
FileSize
4.65 KB

Attached patch implements a slightly more defensive approach — it fixes the warnings and notices, but only marks affected forms as "orphan" in the administrative list.

I did not want to automatically delete orphan entries, since the site administrator would not be aware of those deletions otherwise. (I also consider a warning message as insufficient, since Drupal still does not support persistent messages that need to be acknowledged; thus, if the wrong user happens to hit the page, the information would be lost.)

Are you able to test this patch on your site?

Didier Misson’s picture

I apply the patch :

# cd sites/all/modules/mollom/

# patch -p1 < /home/didier/download/mollom.orphan-forms.3.patch 
patching file mollom.admin.inc
patching file mollom.module
Hunk #1 succeeded at 940 (offset 3 lines).
Hunk #2 succeeded at 1001 (offset 3 lines).
Hunk #3 succeeded at 3201 (offset 7 lines).
patching file tests/mollom.test

I clear the cache.
I go on the "Mollom moderation page" :

Ok, ALL error messages disappear.

(no "orphan" message...)

Thanks,

sun’s picture

Status: Needs review » Closed (duplicate)

Sorry, further investigation revealed that this has the same root cause as #804466: Orphan forms of other modules cause errors on administration page

Thus, merging this issue (+ patch) into that one.