I'm not sure if this is how you'd like to handle it but presently location moduel is throwing errors when a node is saved using node_save() and the $node->locations array doesn't exist. Instead of requiring this attribute i short circuited the switch in hook_nodeapi('insert/update') and "return"ed if the array was empty. See attached patch rolled against DRUPAL-5

CommentFileSizeAuthor
confirmLocationPresence.patch731 bytesmichaelfavia

Comments

sasconsul’s picture

I think, I have seen a similar problem when I add a node through the MailHandler. Here is the error message:

Invalid argument supplied for foreach() in /home/bayareat/public_html/d5/modules/location/location.module on line 791.
Invalid argument supplied for foreach() in /home/bayareat/public_html/d5/modules/location/location.module on line 857.

The patch fixes the problem only for the 'insert' and 'update' $op cases. MailHandler makes the error appear for the 'valdiate' case.

raspberryman’s picture

Subscribing

markusH’s picture

Cool. The same problem appears if you

first: created a biography node using bio.module and attach location info to this content type.
and then: configured bio module to display some fields (which can't be location fields) on the user registration form

Fixed the problem for me.

Is there a chance this fix goes into location module for good?

michaelfavia’s picture

Status: Needs review » Reviewed & tested by the community

tentatively marking rtbc after confirmations above. please downgrade if desired or commit at leisure.

bdragon’s picture

The reason I haven't committed this yet is this is one of the sections that are currently in the middle of being rewritten.

bdragon’s picture

Version: 5.x-1.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Fixed

Fixed in HEAD earlier.

Thanks guys.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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