Okay, this one frustrated me nearly all day. In a nutshell, Location CCK is saving its settings to the wrong table/field. Each instance of a Location widget is supposed to have its settings in content_node_field_instance.widget_settings; what is happening, though, is that any changes to the initial settings are being saved to content_node_field.global_settings. Obviously this creates some problems beyond default values, but that's where I noticed it.

Here's the scenario:

  • Enable Location and Location CCK
  • Go to Manage Fields for any content type and add a Location field
  • Set the initial settings to Allow all fields, set the Province default to "CA" and leave the Country default at "United States"
  • Create a new node -- the defaults are correctly filled in
  • Go to Manage Fields and change the previous defaults to "BC" and "Canada," then confirm the defaults have been saved
  • Create a a new node -- the defaults are the previous values

I'm guessing that fixing this issue will clean up a heck of a lot of other open issues. Just looking at these two database fields it seems that there's a lot of cruft in widget_settings that gets added to each time the settings are saved. Shouldn't these two fields be identical in the number of data points they contain?

Comments

yesct’s picture

Title: Wrong defaults being used » Wrong defaults being used (global_settings widget_settings)
yesct’s picture

yesct’s picture

infojunkie’s picture

I am trying to set the default value programmatically via PHP. The field is not picking up the value, even though I am returning a value of the form

return array(
  0 => array('lid' => $lid),
);

Is my case related to this issue?

yesct’s picture

Status: Active » Postponed (maintainer needs more info)

might be related/duplicates:
#45593: adding support for a default province/state?

If this is still a problem in the latest release, please do some testing and post back, setting the status back to active. Thanks.

ankur’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Not sure if this is still an issue. Please re-open if this problem still occurs.