Closed (duplicate)
Project:
Location
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2007 at 10:51 UTC
Updated:
7 Mar 2008 at 22:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
lias commentedThe location can be added to the user profile during registration, enable it at admin/module settings/location.
I've enabled it but there doesn't seem to be any way of requiring the location fields to be filled out by the user. THis can be done when you create a new node and enable the locative features but I can't seem to find where to do this for the user's profile.
Any ideas?
Thanks!
lsabug
Comment #2
davea commentedNo ideas! Sorry!
This bug has existed for awhile now. Here is the one for 4.7: http://drupal.org/node/119365
I am posting this bug so it doesn't get lost.
Comment #3
stormsweeper commentedI needed similar functionality (as well as the form on account creation) so I hacked up some changes. Attached is a patch against version 1.80 of location.module.
Comment #4
stormsweeper commentedThe above is a patch against HEAD. Here's a patch against version 1.79.2.4 from the DRUPAL-5 branch.
Comment #5
davea commentedI have patched my dev system with this. It appears to work properly.
Comment #6
lias commentedWill this patch be rolled into the next update of the module?
Comment #7
davea commentedThis patch works. However, the required fields for for the user regstration are not stored/retrieved properly. I have spent a few hours looking at this bug and I am still puzzled by ti. The way the new FormApi works has something to do with it but I am not sure what.
I am going to spend some more time on this bug with this patch.
Comment #8
davea commentedOK, here is what I have found:
admin/settings/location/user neither stores the settings for required fields correctly NOR does it retrieve them correctly.
Here is a sample of BAD DATA that is inserted in the variable table after setting the zip code to be required:
Here is what should be stored/retrieved:
I have NO idea why this is occuring. I saved the second value in the DB and user registration now shows the zip code to be required, which is the expected and desired behavior.
I spent several hours on this problem and whoever has the time, I would love to learn what the cause of it is.
Thanks!
Comment #9
seanenroute commentedJust checking to see if there has been an update on this problem, and if it will be added to a final version of the locations module in the near future. It's an awesome feature that would be extremely helpful to a lot of us.
Cheers, Sean
Comment #10
pcorbett commentedI second that... any progress?
Comment #11
bmagistro commentedHas anyone had some success with this module patch?
Comment #12
bmagistro commentedI couldn't get the patch listed for version 5 above to work, so I took a look at the existing code. with the latest version of the location module, i added the block of code below at line 1423 and it added it to the registration form correctly. I am still working on making the fields required and will update when i have something that is working.
Unfortunately this would make it a semi hard coded change.... (since that is what i need i am ok with it but it might be beneficial to add a control to the admin area that says show on registration page and reference that with this if block.
if ($op == 'register' && $user_setting == LOCATION_USER_COLLECT) {
$form = array(1 => array());
$form[0]['location'] = location_form(array('street', 'city', 'province', 'postal_code', 'country'), (isset($user->location) && !_location_is_empty($user->location)) ? location_api2form($user->location) : array('country' => variable_get('location_default_country', 'us')), array(), variable_get('location_suppress_country', 0) ? array('country' => variable_get('location_default_country', 'us')) : array());
$form[0]['location']['#type'] = 'fieldset';
$form[0]['location']['#title'] = t('Location');
$form[0]['location']['#tree'] = TRUE;
$form[0]['location']['#collapsible'] = TRUE;
$form[0]['location']['#description'] = t('Enter as much of your address as you are comfortable with. Your address will only be viewable by those who have the appropriate permissions. The site will be able to automatically link you to driving directions and other features if it already knows your address.');
if ($user->location['lid']) {
$form[0]['location']['lid'] = array(
'#type' => 'hidden',
'#value' => $user->location['lid']
);
}
return $form;
}
Comment #13
nvoyageur commentedI just made a small patch for this that just edits one line of code rather than replicate an entire section.
I've tested it and it presents the location form at registration and stores the submitted info their profile.
It still is not require, but if you have the disclaimer "Enter as much of your address as you are comfortable with...." then required is not an issue.
Comment #14
wildfeed commentedCan users be searched by location?
I have included location module fields in the registration process and I'm able to collect user locations and view them using gmap.
How can Search by Location be used to reuturn a list of USERS (uid) that meet the search criteria (proximity)?
"Search by Location" does return a list of nodes if location info is supplied for them.
I would like users to be able to search for other users by proximity then click the IDs of the usernames returned and be directed to the user profiles of the site members they have found.
Any suggestions for this?
Comment #15
Evermore commentedI was curious if there had been any more headway on this patch? I love the idea of not having "Street" show up on the information to be submitted, and also would like to see the ability to weight the location input form so it doesn't always rise to the top.
Comment #16
bmagistro commentedwhat i wound up using was civicrm since i wanted the newsletter functions from there. that was easily integrated
Comment #17
cday119 commentedHey everyone,
Just figured this one out with some help from askike's patch
In order to get users to submit their locations, install the locations module
Then enable it and in the module administration page enable user locations.
Then patch location.module with the patch I have attached. This patch makes the zipcode field required for submission
Basically the location.module includes the location.inc file and in that file their is a function called location_form() wich allows you to specify required fields. The code is on line 231.
Comment #18
gonz commentedHi everyone - I am sorry to ask such a NB question, but how do I apply this patch - I looked at line 231 and tried to copy and paste this patch code in there - but that definately did not work.
I looked up "applying patch" in Drupal search, but did not find much info.
Any advice?
Comment #19
cday119 commentedAhhh I'm sorry, I' m the noob. I f'ed up the patch,
anyway the code you want to change is on line 1421 of location.module
Line 1421:
should be
You can get the available field names from line 233 in location.inc
They are 'name', 'street', 'city', 'province', 'postal_code', 'country'
So if you wanted to require a postal code line 1421 of location.module would be:
Comment #20
gonz commentedThat worked Perfectly!!! You guys are amazing.
- I added the code snippet from above
- replaced the code at line 1421.
Now I have this code block from 1419 -1455:
if ($op == 'form' && $category == 'account' && $user_setting == LOCATION_USER_COLLECT) {
$form = array(1 => array());
$form[0]['location'] = location_form(array('street', 'city', 'province', 'postal_code', 'country'), (isset($user->location) && !_location_is_empty($user->location)) ? location_api2form($user->location) : array('country' => variable_get('location_default_country', 'us')), array('street', 'city', 'province', 'postal_code', 'country'), variable_get('location_suppress_country', 0) ? array('country' => variable_get('location_default_country', 'us')) : array());
$form[0]['location']['#type'] = 'fieldset';
$form[0]['location']['#title'] = t('Location');
$form[0]['location']['#tree'] = TRUE;
$form[0]['location']['#collapsible'] = TRUE;
$form[0]['location']['#description'] = t('Enter as much of your address as you are comfortable with. Your address will only be viewable by those who have the appropriate permissions. The site will be able to automatically link you to driving directions and other features if it already knows your address.');
if ($user->location['lid']) {
$form[0]['location']['lid'] = array(
'#type' => 'hidden',
'#value' => $user->location['lid']
);
}
return $form;
}
if ($op == 'register' && $user_setting == LOCATION_USER_COLLECT) {
$form = array(1 => array());
$form[0]['location'] = location_form(array('street', 'city', 'province', 'postal_code', 'country'), (isset($user->location) && !_location_is_empty($user->location)) ? location_api2form($user->location) : array('country' => variable_get('location_default_country', 'us')), array('street', 'city', 'province', 'postal_code', 'country'), variable_get('location_suppress_country', 0) ? array('country' => variable_get('location_default_country', 'us')) : array());
$form[0]['location']['#type'] = 'fieldset';
$form[0]['location']['#title'] = t('Location');
$form[0]['location']['#tree'] = TRUE;
$form[0]['location']['#collapsible'] = TRUE;
$form[0]['location']['#description'] = t('Enter as much of your address as you are comfortable with. Your address will only be viewable by those who have the appropriate permissions. The site will be able to automatically link you to driving directions and other features if it already knows your address.');
if ($user->location['lid']) {
$form[0]['location']['lid'] = array(
'#type' => 'hidden',
'#value' => $user->location['lid']
);
}
return $form;
}
Thanks again for everything.
Comment #21
bdragon commentedDuplicate of http://drupal.org/node/74924.