Skip to: Site menu | Main content

drupal

Custom GMap Solution for Automatically Centering on User Location (Part 3)

In my previous two posts, I discussed how I implemented dynamic markers and the PdMarker custom marker type into the home page for OffRoadAtlas.com. The final major GMap customization I added was the ability of the map to automatically center and zoom on the user's location based on their IP address. The solution isn't always perfect (depending on the user's internet access provider), but more often than not, it gets pretty close.

The tricky part of implementing this feature was being able provide it for anonymous users while Drupal caching mechanism was activated. Later in this post, I'll show you how I did it using a combination of hook_init(), cookies, and Javascript.

Submitted by michael on Sun, 08/31/2008 - 10:33am
Filed under:

Custom GMap Solution for Dynamically Updated Markers (Part 2)

In my previous post, I talked about how I implemented the dynamic marker system on OffRoadAtlas.com. In this post, I'll cover the functionality that the PdMarker adds to the site.

When you first hit the home page of the site, you'll see that the main content area is separated into two main sections: the narrow column to the left of the map (I call this the "info column") and the map itself.

Submitted by michael on Wed, 08/27/2008 - 10:54am
Filed under:

Custom GMap Solution for Dynamically Updated Markers (Part 1)

I recently upgraded OffRoadAtlas.com with a custom map interface based on the GMap module. I was able to do this while leaving the GMap module is virtually un-hacked (with the exception of modifying the "GMAP_API_VERSION" variable) - all of the customizations were made via an additional "helper" module that was written specifically for this site.

The site utilizes a map on the home page that shows all the off-roading areas and clubs in the database. The problem I was trying to solve was that I didn't want to have to load all 1,500+ points each time the home page was hit. Not only was this a waste of resources, but it also slowed things down considerably for the user.

Submitted by michael on Mon, 08/25/2008 - 10:08am
Filed under:

Role Playing: Clear the Cache

Maybe this was covered somewhere on drupal.org awhile back, but either I wasn't searching using the correct terms or I just plain missed it. I'm talking about how to avoid issues when programmatically modifying user roles.

I was working on a module that automatically adds and removes user roles when certain conditions are met. The code to remove and add a user role is pretty straight-forward:

db_query("DELETE FROM {users_roles} WHERE uid = %d AND rid = %d", $user->uid, $rid_to_delete);
db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $user->uid, $rid_to_add);

I thought this was all I needed to do. My initial testing didn't find anything unexpected, so I moved on to something else.

Submitted by michael on Mon, 05/12/2008 - 1:43pm
Filed under:

Orlando Drupal User's Group Presentation

Yesterday I gave a presentation to the Florida Drupal User's Group at the Orlando Public Library.

We had about a dozen people show up, and there's a lot of interest in future meetups. So much so, in fact, that we went ahead and scheduled monthly meetings (3rd Saturday of every month). We have topics and speakers lined up for the meetups through October. See the meeting wrapup for all the info.

Here's some links to some stuff we discussed that I promised to post:

Submitted by michael on Sun, 04/13/2008 - 11:31am
Filed under: