Good morning everyone,

I'm working on developing some integration between the smartIP's geolocation tool for anonymous users, and location's functionality. My goal is to pass a "faked" location from the anonymous user to the correct data fields in their anonymous user object so other modules can better rely on user locations.

The snag where I could use a hand is the existence of user location data. If I do a user_load, location information comes in just fine. But if I dump the global $user object, no location information exists. I'm testing with the same account for both methods, uid=1.

Was there a decision made to not load location information into the $user object, or am I just missing it somehow? If not, is this something you would like a patch to ensure it exists?

Comments

lance.gliser’s picture

Version: 6.x-3.x-dev » 6.x-3.1

Changed the version, sorry about that.

lance.gliser’s picture

Did more digging on my own, and it seems like this a Drupal core issue, not a location issue. http://api.drupal.org/api/drupal/developer--globals.php/global/user/6

Which then leads me to wonder what the best way to pass the faked locations to anonymous users would be, since my original plan failed. Would you prefer I use location_invoke_locationapi to alter the location? Will it even get that far? Would it be better to put in another invoke, or integration line in the user_load to try a smartIP load if no user locations are defined?

hutch’s picture

Don't know if this helps, but in my Getdirections module I use

$location = location_load_locations($user->uid, 'uid');
lance.gliser’s picture

Title: The global $user->location undefined? » Request for hook_invoke on location data
Category: support » feature

That's an elegant way to load it, for sure. Not exactly what I'm suggesting though.

Right now the location_user.module fires location_user_user, which is a closed system. It runs location_load_locations, which can not be interacted with, then returns.

What would really help out my work, and the community as well I think. Would be a hook somewhere in that process where other modules could provide or alter location information. In my case, I would want the option of something like _invoke_all('user_locations', $user->locations). This would allow me to provide a best guess location to all modules that can use user locations, through geotargeting provided by smartIP.

arpeggio’s picture

Subscribing.

legolasbo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing old D6 issues as D6 is end of life