Closed (fixed)
Project:
Location
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Mar 2010 at 22:55 UTC
Updated:
11 May 2011 at 11:38 UTC
Jump to comment: Most recent file
Comments
Comment #1
frankcarey commentedhere is the 1 line patch
Comment #2
frankcarey commentedComment #3
roball commentedI have applied that patch to the latest 6.x-3.x-dev version, but it didn't solve my problem with the Location CCK module: even if I have set "Please select" as the default country in the Collection settings, "United States" will be the default country when adding new content.
Comment #4
roball commentedCould you reproduce the bug I have reported?
Comment #5
frankcarey commented@roball, I'm using 6.x-3.1-rc1 and CCK is giving me the "Please select" on new location fields. However, it doesn't look like it's actually saving the country if it is US, on if it is non-us. for some reason, is this your issue?
Comment #6
frankcarey commentednote: you have to save the default in the field settings for your cck location field (not the general settings)
Comment #7
frankcarey commentedComment #8
yesct commentedI'm a little confused, frankcarey, from your point of view, is this one line patch still needed and works to solve your problem? Does it cause any problems for others you think?
Comment #9
yesct commentedmarked #704320: Autodetect country based on lat/lon as a duplicate of this issue
Someone please confirm that it is in fact a duplicate.
Comment #10
roball commented@frankcarey: a patch must be against the latest CVS version and not against a version that is more than one year old (6.x-3.1-rc1)!
Comment #11
hutch commentedOn #9
No this is not a duplicate, #704320: Autodetect country based on lat/lon is impossible to achieve.
This issue is about a default setting (country = us) which caused a problem with an import using the migrate module. It seems reasonable to me that the default should be country = '' but it will mean that a default will have to be willfully selected on location install. Those who do not do that should expect to find themselves in Afghanistan, hehe
I haven't tested this against a fresh install, but here is an updated patch on current CVS (hope it sticks)
Comment #12
roball commentedThe patch applies fine, however it does not solve the problem for me. In the global settings (admin/settings/location) I have the "Default country selection" changed from "United States" to be empty (the first option). On a Location CCK field, I've set the Country to be required and set its default to "Please select". I have cleared all caches.
However, when I want to create a new content of that type, the damn "United States" default is still there. This doesn't make sense to me since most of my users would select an European country. The same result without or with the patch :-(
Comment #13
hutch commentedHmmmm.
Have you got your preferred country set in the variable table?
Look for 'location_default_country'
On closer inspection the default 'us' is sprinkled about all over the place, I suspect it would take quite a bit of recoding to get the location module and submodules to accept an empty default, not part of the original design.
On a Linux box I ran I ran
grep -rn "'us'" * | grep -v 'zipcodes'and see it in all sorts of filesIt looks like you *have* to have a preferred country, mine is set to uk and that is what the country dropdown is always on.
So this patch in my opinion is not worth bothering with.
Comment #14
hutch commentedI have just done a fresh install of Drupal 6.16, using modules
Content 6.x-2.6
Location 6.x-3.x-dev
GMap 6.x-1.x-dev
GMap Location 6.x-1.x-dev
Views 6.x-2.10
I deliberately left 'Default country selection' empty and then created a new content type using location cck, also left the country field to 'Please select'. When I go to create content for that content type the country dropdown shows 'Please select'. So leaving the field empty *does* work.
Perhaps you need to go into the variable table and delete the entry for 'location_default_country' and then immediately go to admin/settings/location and hit Save configuration. Then go and edit your content types, setting the country field to 'Please select'. That might do it.
Comment #15
roball commentedHm, didn't work for me, unfortunately. And, both defaults (globally and per-field) have originally been pre-set to "United States". I had to explicitly select it away from that, but the US default is still there.
Comment #16
yesct commentedroball, please try it on a clean install. as a sanity check.
then the issue here is to figure out what to do to get it work on your current site, yes?
I agree with Hutch and suspect there is some setting in the db that needs to be deleted so the new changes from the dev version of the module will work as they do in a clean install.
Comment #17
yesct commentedwhat is a summary of this issue? Does the patch in #11 fix the importing with migrate module issue (the original issue here)?
does it cause any problems in other areas?
Maybe another issue needs to be opened for the general default country problem? (it was mentioned that 'us' is sprinkled in the code in various places).
I think a new summary of this issue will help the maintainers decide whether to commit this or not.
Comment #18
hutch commentedMy own take on my patch #11 is that it does not solve anything. On a clean install I am able to switch country on and off at will (without patch) and it is reflected elsewhere, as I stated in #14
I may however not have looked *everywhere*, I was to be honest trying to get my getdirections module to work cleanly with a default of 'no country' (it does now).
So the issue in seems to me is wether a willfully selected default of 'no country' is reflected throughout, there are so many combinations of location, location_cck, gmap etc that I get a bit lost ;-(
Can anyone else reproduce the problems roball was having in #12 ?
Comment #19
yesct commentedtagging. there might be a few issues dealing with default countries, hopefully organizing will make it easier to work on them.
Comment #20
Stephen Scholtz commentedYea, I'm having some weirdness with default countries. But then again, default countries (or default anything) and the Location CCK field are kind of confusing, 'cuz it looks to me that there are 3 different places you can set a "default country":
1. The Location settings (/admin/settings/location/main): This sets a variable, 'location_default_country', inside the 'variable' table.
2. The "Collection Settings" (inside the 'Locative information' fieldset) for an individual location cck field: This sets some defaults inside the 'content_node_field' table.
3. The "Default Value" settings, which are present for any CCK field (it's collapsed by, uh, default): I believe this sets a value inside the 'content_node_field_instance' table, in the 'widget_settings' column, although it's hard to tell exactly what's going on there. (I don't know enough about CCK or Location's internal workings, but it looks like a nested recurisive array of values, and in my experiment it seemed to include default country values from #1 and #2 above, plus #3, with 3 being the highest.)
Whatever you set #3 to, that's the one that "sticks", superseding all other values, and will show up in your content type after clearing your cache.
So roball, set the "default value" of your location CCK field to "Please select", and that's what will show up in your content.
This kind of makes sense - you're setting the default value for the CCK field, and like any other CCK field, whatever you set in there is what shows up when you create a new node. What's confusing is all the other places you can set defaults for the location field in the UI. :P
Hope that helps? So maybe this "default country" issue isn't a bug?
Comment #21
roball commentedYeah Stephen - this did it! I oversaw that (collapsed) "Default value" fieldset provided by CCK core. Even if I had set "Please select" on places #1 and #2, at #3 there still was the "United States" value. So just setting the desired default at #3 indeed solved the problem :-)
Thank you for this thread's most useful comment! Since the problem could be solved I think this ticket can be closed. However, Location CCK should not provide #2 at all - just adds confusions and let the user think #3 is not needed. We should probably open a new ticket for this one.
Comment #23
lolmaus commented#20 helped me out, thx!
Comment #24
shiraz dindarword up -- #20 saved my ass. thanks stephen and others for your persistence!
Comment #25
weseze commentedThis is very confusing. How can we make this less confusing?