Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Can the distance filter in location views be based on the user locations rather than just long/lat and postcode?
Comment | File | Size | Author |
---|---|---|---|
#8 | user_locations.patch | 2.87 KB | evanbarter |
#7 | user_locations.patch | 2.7 KB | evanbarter |
Comments
Comment #1
sziggle CreditAttribution: sziggle commented+1 for this request. the views Distance / Proximity display field can default to the user's location, and the views Distance / Proximity sort criteria can default to the user's location. if the filter could do it as well, this views implementation would do exactly what i need; allow me to create a view / page / block that shows a list of nodes with locations that are within some fixed distance of the user's location (without making the user input their zip code).
[if anyone knows a way to mangle views into constructing the right query for this use case prior to this module supporting it, please let me know cuz i am on a deadline... of course]
-thanks!
Comment #2
YesCT CreditAttribution: YesCT commentedtagging to help find if this is a duplicate request, this might also be related to views arguments.
might be a duplicate of #357295: Proximity Search based on lat/lon, using views arguments
Comment #3
mkinnan CreditAttribution: mkinnan commentedI am also trying to do this. I want to create a Map or a Table of nodes relative to a user's location. I thought this might be done with views relationships, but there are not any for a user's location ... at least from what I have seen.
Comment #4
chaosprinz CreditAttribution: chaosprinz commentedSubscribing.
I tried to give a relationship to the exposed-proximity-filter, but it doesent work. When i use the relationship on other exposed location-filter it works.
Btw. its a relationship to node-relativity: parent-node-id
But had the same issue, when trying other relationships. This would be a real great feature.
Comment #5
sagannotcarl CreditAttribution: sagannotcarl commentedFor my needs this does seem like a dupe of #357295: Proximity Search based on lat/lon, using views arguments (for vice versa), but on that thread there is some talk of a more programmatic way to do it and I'm more interested in having this functionality in the views interface.
There is a description here #334846: Center Gmap on Node passed as argument in view (#2) that seems like what I want but there is one step that I don't understand.
Comment #6
creativegenius CreditAttribution: creativegenius commentedsubscribe
Comment #7
evanbarter CreditAttribution: evanbarter commentedThis is some functionality I'd love for a site I am building, so I thought I'd get my hands dirty. I'll throw some more hours at this tomorrow if no one picks it up in the next 24 hours.
Couple of things: (1) I've done little to no testing of this other than checking it doesn't completely bomb with errors, because (2) It's well after midnight, and (3) This is the first patch I've ever done for Drupal or a Drupal module!
Patch provides a new "Form mode" (I don't like that name either) which allows user to select one of the locations attached to the user itself. At the moment it only checks to see if the location has a name and then runs with that. This is a bad bad bad idea since this field can be disabled, so this is the first thing that needs to be worked on. I was thinking of doing it based on the lat/lon of the location and inferring a name for it based on what data is available. Not sure how this will work with JIT geocoding, something for me to look in to I guess. Please review and comment!
Cheers,
Evan
Comment #8
evanbarter CreditAttribution: evanbarter commentedFixed a blocker, locations will also fall back to title "Location #x" now when there's no name.
Comment #9
jdln CreditAttribution: jdln commentedHas any progress been made on this?
Thanks
Comment #10
Todd Young CreditAttribution: Todd Young commentedanything yet?
Comment #11
YesCT CreditAttribution: YesCT commentedjdin and yountod (and others) thanks for your interest; sometimes we need reminders to look at these issues.
Forgive me if you already know this, but sometimes people dont...
Drupal and Drupal modules in general and specifically location do not have any people paid to code or maintain them. The people who work on it do it without getting paid (well, some people might get paid if their company is using location module, but I dont know of anyone in that situation ... anyway).
So, to get progress on this issue we need your help. Yes, YOU. :)
But I (and others) can help you do that.
Check out how to apply patches:
http://drupal.org/patch/apply
And how to review patches:
http://drupal.org/patch/review is some official words on how to do a
review. But in general you try out the patch and then you say if the patch patches, if
it didn't: copy and paste the error. Say how the site functioned
before (what was wrong), say how the patch changed the behavior (did
it fix something? did it break anything else?), also, a code review of
code style http://drupal.org/coding-standards and security
http://drupal.org/writing-secure-code and if it is good for themers (I
dont know of a link for this... ) BUT you do NOT have to do all of the
review, or all of it at once. Do what small parts of the review you can, and post those results.
Someone else can then review the other parts (say theme or security or
whatever), or you can come back later add add to the review.
here is an example of a good review: http://drupal.org/node/182786
Dont be afraid to change things with the issue, add better words to
the title, mark things as duplicates, say it needs work, or needs
review... If someone doesn't agree, someone will change details back
or to something else. :)
I dont have any special position in location... I'm "just a user" :)
... just a user that want to use location and wants to make it easier
for the maintainer to maintain so it is maintained. :)
Together we can get location in a good place!
Also, note you will want to set up a test site so you dont mess up your live site.
You can get live help from me (YesCT) or anyone in IRC:
http://drupal.org/irc
People in IRC especially like to help people who go there and say "I never reviewed a patch before. I want to contribute. What do I do?" ... or something like that.
Comment #12
Todd Young CreditAttribution: Todd Young commentedI rolled up my sleeves and gave it a shot - it seems to be working with one substantial glitch yet to be knocked out.
I'm hope I'm talking apples-and-apples here? You can check out the thread (and the code) at #767946: Allow the proximity filter to use a node argument's location as a center
Scroll down to #5 to see where I modified nicholasThompson's code to consider users instead of nodes.
Comment #13
dawehnertabs. Please use spaces instead
Powered by Dreditor.
Comment #14
artscoop CreditAttribution: artscoop commentedHi,
There may be something very simple for this.
For example, you can make the distance filter work with the current user location by letting the Lat, Lon an Postalcode fields empty.
That would use the user location by default, since there is no point in using a (0,0) point for reference.
Hmh oh well, it has already been done just above :D
I think this patch is the way to go.
Comment #15
artscoop CreditAttribution: artscoop commentedWell no, this code was not meant for non exposed filters,
this code should be useful.
just after
I may provide a patch later.
Comment #16
rooby CreditAttribution: rooby commentedThanks for the work on this patch.
I know this issue has been around longer but I am marking it as a duplicate of #718928: add options to set coordinates w/ user location, PHP code for field, filter because that patch has more functionality.
Previously it did not have your option to select which of the users locations to use in the exposed filter so I added that to the newest version of the patch.
If there is anything else that the patch here was going to provide that the other issue doesn't cover just bring it up in the other issue and it can be added.