MichDe / wordpress-geo-mashup

Automatically exported from code.google.com/p/wordpress-geo-mashup
1 stars 0 forks source link

Unable to use geo date feature #582

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I found this code on 
https://groups.google.com/forum/?fromgroups#!topic/wordpress-geo-mashup-plugin/S
lFcQKtW17E

It is supposed to show a global map of location based on a geo-date of today 
and the future. Basically it won't show locations whose geo-date has passed. 

I'm trying to use this code but haven't been successful. I tried to clear the 
code a bit but even that hasn't helped. It just breaks wordpress. Does anyone 
know the problem?

n "Theme Functions" (functions.php) 

/** geo mashup stuff **/ 

    /* 
    * Used for filtering on geo_date 
    * Last Update: 10 June 2010 
    * By: Joseph Hoetzl ( http://www.josephhoetzl.com ) with a LOT of 
help from Dylan Kuhn ( http://www.cyberhobo.net/blog ) 
    * 
    * Usage: 
    * Add the parameter: 
custom_geo_date_filter="current_and_future_only" to the geo_mashup_map 
shortcode 
    */ 
    function current_and_future_geo_date_filter( $where_clause ) { 
    if (!empty($_GET['custom_geo_date_filter']) && 
'current_and_future_only' == $_GET['custom_geo_date_filter']){ 
        $strippedDate = date( 'Y-m-d', time()); #Get just the date 
from the server date/time 
        $justDateAsArr = explode("-",$strippedDate); #Create an array 
from the date 
        $adjustedDateTimeAsInt = mktime(0,0,0,$justDateAsArr[1], 
$justDateAsArr[2],$justDateAsArr[0]); #Workaround for time part since 
geo_date doesn't include time zone 
        $where_clause .= " AND gmlr.geo_date >= '" . date( 'Y-m-d 
H:m:i', $adjustedDateTimeAsInt) . "'"; #gmlr is the alias assigned to 
the sql select statement 
        } 
    return $where_clause; 
    } 

    add_filter( 'geo_mashup_locations_where', 
'current_and_future_geo_date_filter' ); 

/** end geo mashup stuff **/ 

In the page's shortcode, added the parameter: 

custom_geo_date_filter="current_and_future_only" 

example of the full shortcode: 
[geo_mashup_map map_content="global" auto_info_open="false" 
marker_select_center="true" 
custom_geo_date_filter="current_and_future_only"] 

Original issue reported on code.google.com by y...@projectcloud.info on 1 Jul 2012 at 11:36

GoogleCodeExporter commented 9 years ago
That code isn't currently part of Geo Mashup, but there is a feature request 
for it in issue 491. I have used similar code successfully on production sites.

Original comment by dylankk...@gmail.com on 26 Jul 2012 at 2:08