Active
Project:
Location
Version:
7.x-3.0-alpha1
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jun 2012 at 15:58 UTC
Updated:
22 Jan 2018 at 05:03 UTC
Jump to comment: Most recent
Error message
Notice: Undefined index: country in _location_process_location() (line 311 of .../sites/all/modules/location/location.module).
This is location 7.x-3.x-dev (2012-May-04)
I'm getting this error, after turning off user locations (as mentioned in the thread I bumped by mistake) and I'm NOT using Profile 2. I did recently migrate a phpbb3 forum using phpbb2drupal. So I tried turning off those modules, turning them back on, cleared cache & everything. Still getting the error.
I'm not sure when it started, since I only recently started adding new events again recently.
Could anything else be getting in the way? My event date fields list all the states though I only use Pennsylvania, and I'm not using Country.
The field list doesn't show anything out of the ordinary either.
Comments
Comment #1
mrweiner commentedI'm having the same issue. Just went to add a new location/edit a location in a development site, and got the same message. I believe I fixed it before by making sure a default state was selected in the content type, which is I just changed accidentally. Now, even when having a default state, the message still comes up.
Comment #2
rhip commentedI am also getting this message.
Notice: Undefined index: country in _location_process_location() (line 311 of /mywebsite/sites/all/modules/location/location.module).
The location module was working perfectly until this morning. Weirdly, I haven't tinkered with it for about a week, so I am just trying to work out why it would have suddenly started producing this error.
I add a node with the full lcoation information (postcode etc.) then I save it and view it, and there is no address/map etc. I click 'edit' and all of the location fields are blank - that information seems to have been wiped.
Will let you know if I find a fix.
Comment #3
rhip commentedI fixed this by disabling the Node Locations 7.x-3.xdev module (under Location on the module list). I think it was just part of the Locations bundle.
Comment #4
Seneschall commentedProblem is, I'm sort of wanting to use the Node Locations, as it's an area map of events & listings in a small town.
Comment #5
Seneschall commentedJust found this error on a 2nd site using locations. Anything new on this?
Comment #6
mrweiner commentedI stopped using this module after this issue came up, and switched to address field. I then realized that even with proximity search through geofield, the implementation through this module is superior. I also need the node location functionality, so I'd love if this issue would go away. I just decided to give Location a try again, in hopes that this issue had been fixed, but it unfortunately had not. I have changed the version to 7.x-1.0-beta1 since that is what I tested the below information on, but the steps to recreate are probably the same in 7.x-3.x-dev as well. In the past, I was having the same issues in 7.x-3.x-dev.
It seems that this occurs both when the option for Country is "force default", and when it is set to "allow". Obviously, one of the two is needed in order for the "State" dropdown/autocomplete to be populated correctly. If set to "force default", it populates the "state" field correctly the first time, but the error is thrown upon node save and then the only options for the state are "please select" and "NOT LISTED". If the state field is instead set to autocomplete, then there are simply no autcomplete options. If Country is set to "allow", then the state options are populated correctly when the country is selected, but the error is again thrown on node save. As a result of these issues, no data is saved for either Node Location or the Location CCK Field.
At some point before, I was able to fix the problem by setting default values for both State and Country, but this has since failed to fix the problem.
I also notice that, as stated above by RhiannonAmyBuck, the issue disappears when the Node Locations module is disabled. In this case, data for the Location CCK field saves just fine. Also, I just noticed that if there is already data saved in the Location CCK field, and then Node Locations is enabled, then everything saves fine. The CCK data stays the same, and the data saves to the Node Location area.
I'm not sure whether or not User Locations presents the same error, as I have not had the chance to toy with it yet, but it should probably be looked at as well.
EDIT: It should be noted that the above was experienced with a pre-existing node. I haven't tried to reproduce yet with a newly created node.
Comment #7
mrweiner commentedDo the module maintainers happen to have any update on this? I thought it may have been fixed since the alpha for 7.x-3.x was just released, but the issue is still present. At this point, it seems that node locations shouldn't even be included with the main module since it essentially non-functional (for at least a percentage of users).
Comment #8
i-dont-use-this-account commentedI have the same problem, and it persisted when I turned off the node locations (which I need).
So, the simple fix is to open up that file, location.module and just hard code your default country.
So, for the United States, line 311 becomes:
instead of
If you need another country, just go to the form used to add a location, view source on the country field, and get the value of the option.
Comment #9
rooby commentedI agree, location_node and location_user should both be removed, but that shouldn't affect you using the module.
They shouldn't be used with Drupal 7 and are really only legacy from Drupal 6.
What is the reason you're trying to use location_node instead of location_cck (which also should be renamed to location_field or similar)?