Active
Project:
GMap Module
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Dec 2008 at 19:35 UTC
Updated:
13 Jan 2013 at 06:14 UTC
So I only want this block to show up on pages that have a Latitude and Longetude and have tried lots of different things and none seem to work even using Variables out of the Module itself. Can anyone steer me in the right direction?? I have searched high and low on drupal and can find no one with this problem.
Here is what I'm currently have in my Block Visibility and doesn't work, I also Tried $location from another post I found about something not really related.
<?
global $map;
if ( ($map['latitude'] != 0) && ($location['longitude'] != 0) )
return TRUE;
}else {
return FALSE;
}
?>
Comments
Comment #1
davidhk commentedI've changed this to be a bug, as in the D5 version it only appeared on nodes that had a lat/lon set. (I've just uploaded from the D5 to D6 version of GMap, and run into this same problem).
I also had a go at writing some workaround php to paste into the block's visibility settings:
But mine doesn't work either! Has anyone else got a workaround?
Comment #2
davidhk commentedHere's a fix to the code that is working for me.
Edit file gmap_location.module, and look for function gmap_location_block_view($nid).
Scroll down to line
if ($loc['latitude'] || $loc['longitude']) {and change it to
if (($loc['latitude'] != 0) || ($loc['longitude'] != 0)) {The original version of this line also appears in the Drupal 5 version, so I'm not sure why it works there but not here.
Comment #3
AtomicStudios commentedThanks!!!
Comment #4
rooby commentedThe same code as mentioned in #2 is still in the latest version so this still applies.
The question is whether or not to change the functionality now that potentially a lot of sites have the current functionality.
It would probably be better off as a block setting to choose what happens when there are no locations.