Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Drupal logs several php notices:
Notice: Trying to get property of non-object at ideal_comments_form_comment_form_alter() (at line 46 of /.../sites/all/modules/ideal_comments/ideal_comments.module).
Seldom for registered users and quite often for cron.
It seems that $node arrives as non-object to line 46:
'#access' => (variable_get('comment_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_DISABLED),
Running on drupal v7.20
Comment | File | Size | Author |
---|---|---|---|
#1 | ideal_comments-non_object_form_alter-1927222-1.patch | 684 bytes | drupov |
Comments
Comment #1
drupov CreditAttribution: drupov commentedI have the same error when I am searching nodes which are panelized. For some reason hook_form_FORM_ID_alter() gets called but no $node-object can be loaded because menu_get_object failes to provide the information.
I've attached a patch to load the node through the information about its nid in the $form-array.
Comment #2
Iztok CreditAttribution: Iztok commentedYep, menu_get_object() looks like a wrong approach, patch fixes that.