• Hi, this plugin looks great, and ideal as i’m setting up a website for a friend who is cycling 1400 miles.

    Trouble is: This is my first use of wordpress and I’m probably missing something very simple. I’ve followed the instructions without a problem and my location syncs fine. But after inputing the basic code [glatitude-map /], no map is shown.?.

    Now, I am probably missing something very simple and fundamental to wordpress and I realise I’m being pretty vague. .. but any ideas??

    Thanks, Carl.

    http://wordpress.org/extend/plugins/google-latitude-history/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author peter2322

    (@peter2322)

    thanks for trying the plugin. lets see if we can get it working.

    It sounds like a javascript issue. Is the url publicly available? if so i can easily check for a javascript error or investigate the error yourself with the instructions below.

    Open up Google Chrome and navigate to the page with [glatitude-map /] in normal view mode (as your audience would see it). Right click on the page and select ‘Inspect Element’ which opens the developer tools. Then choose ‘Console’ in the developer tools header. Reload the page. Do you see any errors in the ‘Console’? if so please post them here.

    Thread Starter popolo512

    (@popolo512)

    Thanks alot Peter,

    The page is at http://throughthedoor.co.uk/cycletospain/?page_id=11

    There are 2 errors;

    Uncaught SyntaxError: Unexpected token < /cycletospain/?page_id=11:94Uncaught SyntaxError: Unexpected token <

    Uncaught ReferenceError: gLatitudeHistoryAttributes is not defined
    createGLatitudeHistoryMap
    (anonymous function)
    e.extend.each
    e.fn.e.each
    (anonymous function)
    f.Callbacks.n
    f.Callbacks.o.fireWith
    e.extend.ready
    c.addEventListener.B

    Thanks for helping me with this. Carl.

    Plugin Author peter2322

    (@peter2322)

    ok, for some reason your web server is inserts <p> into the html generated by the shortcode. this is causing the javascript to break.

    i need to find a better solutions then this. But can you try putting the code all on one line. go to /wp-content/plugins/google-latitude-history/google-latitude-history-map.php and change

    ?>
    		<div id="gLatitudeHistoryMap_<?php echo $count; ?>" class="gLatitudeHistoryMap" style="height:<?php echo $attributes['height']; ?>px; width:<?php echo $attributes['width']; ?>px;<?php echo $customStyle; ?>"></div>
    		<script type="text/javascript">
    			<?php if($count == 1):?>
    				var gLatitudeHistoryLocations = new Array();
    				var gLatitudeHistoryAttributes = new Array();
    			<?php endif;?>
    
    			gLatitudeHistoryLocations[<?php echo $count; ?>] = <?php echo json_encode($latitudeHistory); ?>;
    
    			gLatitudeHistoryAttributes[<?php echo $count; ?>] = <?php echo json_encode($attributes); ?>;
    		</script>
    	<?php

    TO:

    ?> <div id="gLatitudeHistoryMap_<?php echo $count; ?>" class="gLatitudeHistoryMap" style="height:<?php echo $attributes['height']; ?>px; width:<?php echo $attributes['width']; ?>px;<?php echo $customStyle; ?>"></div><script type="text/javascript"><?php if($count == 1):?> var gLatitudeHistoryLocations = new Array(); var gLatitudeHistoryAttributes = new Array(); <?php endif;?> gLatitudeHistoryLocations[<?php echo $count; ?>] = <?php echo json_encode($latitudeHistory); ?>; gLatitudeHistoryAttributes[<?php echo $count; ?>] = <?php echo json_encode($attributes); ?>; </script>	<?php
    Thread Starter popolo512

    (@popolo512)

    Brilliant!!!

    It’s working with your ‘one-line’ fix.

    What an odd one!

    Thank you very much. Carl.

    Plugin Author peter2322

    (@peter2322)

    great, i am so glad that worked.

    Thread Starter popolo512

    (@popolo512)

    Hi Peter,

    Sorry, I’m having the same problem again with unable to view the map.

    I’ve tried following the instructions above but the filenames seem to have changed with an update and I can not find where the error is…

    The page is at http://www.cycletospain.co.uk/?page_id=195

    The couple I am doing this for are setting off on their 1400mile cycle on the 1st of April. I’ve just reviewed the site to ensure everything was working and I can’t get this working properly.

    Please help. Thanks, Carl

    Thread Starter popolo512

    (@popolo512)

    ah, noticed that you had changed the code so it’s now on one line.

    There are no errors in ‘console’ but still doesn’t work. ??

    Plugin Author peter2322

    (@peter2322)

    i am sorry to hear that the new version broke your webpage.

    its not the same issue. The problem is that the javascript to create the map is not being included in your page. My guess right now is that it has to do with your theme. Can you provide me with your theme?

    To get the page up and running as fast as possible I would degrade to version 0.9.8. Deactivate the plugin, delete the plugin, and then install v0.9.8 (http://wordpress.org/extend/plugins/google-latitude-history/download/).

    Thread Starter popolo512

    (@popolo512)

    Thanks for getting back to me Peter.

    I’m using Striking Theme.

    I’ve degraded to 0.9.8 and 0.9.7 with no joy. I’ve made the alterations to /wp-content/plugins/google-latitude-history/google-latitude-history-map.php as before and the map is still not showing.

    Also, I’m getting this error – Your OAuth token is stale, please refresh the token on the settings page. Reason: Error calling GET https://www.googleapis.com/latitude/v1/currentLocation?alt=json: (403) Access Not Configured

    I’ve tried creating another client id and client secret. I’ve ensured all the settings are the same as before. No joy…

    Any ideas??

    Sorry to bother you over the weekend. Carl.

    Plugin Author peter2322

    (@peter2322)

    hi carl,

    I have a simple solution to the problem. Since the plugin is failing to inject the javascript files into the page then we can add them ourselves.

    1. Install version 0.9.9
    2. edit google-latitude-history.php by commenting out the following line

    //add_action('wp_footer', array(&$plugin_glatitudehistory, 'wpFooter'));

    3. replace GoogleLatitudeHistoryMap.php with

    <?php 
    
    class GoogleLatitudeHistoryMap {
    
    	function generateMap($attrs, $latitudeHistory, $customStyle, $count) {
    
    		$attributes = shortcode_atts( array(
    			'height' => 400, // number for pixel
    			'width' => 600, // number for pixel
    			'max' => 30, // number of locations
    			'maptype' => 'TERRAIN', // HYBRID, ROADMAP, SATELLITE, TERRAIN
    			'mapcontrol' => 'true', //true/false
    			'controlstyle'=> 'DROPDOWN_MENU', // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
    			'zoomcontrol' => 'true', //true/false
    			'zoomstyle' => 'SMALL', // DEFAULT, SMALL, LARGE
    			'pancontrol' => 'false', // true/false
    			'streetcontrol' => 'false', // true/false
    			'haveoverview' => 'false', // true/false
    			'openoverview' => 'false', // true/false
    			'disabledefaultui' => 'false', //true/false
    			'showpath' => 'true', // true/false
    			'pathcolor' => 'black', // CSS3 colors  #6699ff (blue)
    			'pathweight' => 1, // number of pixels
    			'pathopacity' => 0.1, //0.0 - 1.0
    			'currentcolor' => '#FF0000', // CSS3 colors in HEX
    			'pastcolor' => '#6699ff', // CSS3 colors in HEX
    			'openwindow' => 'true', //true/false
    			'disablewindow' => 'false', //true/false
    			'style' => '' //css
    		), $attrs);
    
    		foreach($attributes as $key => $value) {
    			$lcValue = strtolower($value);
    			if( $lcValue == 'true' ) {
    				$attributes[$key] = true;
    			} elseif( $lcValue == 'false' ) {
    				$attributes[$key] = false;
    			}
    		}
    
    		if($attributes['style'] != '') {
    			$customStyle = $attributes['style'];
    		}
    
    		ob_start();
    
    		// html stuff is all on line b/c a user had <p> inserted at the returns causing the javascript to break
    		// this fixed the problem, i have no clue why that happened. http://wordpress.org/support/topic/plugin-google-latitude-history-not-displaying-a-map
    	?> <link rel="stylesheet" id="google-latitude-history2-css"  href="<?php echo plugins_url('css/glatitudehistory.css', __FILE__); ?>" type="text/css" media="screen" /><script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script><script type="text/javascript" src="<?php echo plugins_url('js/StyledMarker.js', __FILE__); ?>"></script><script type="text/javascript" src="<?php echo plugins_url('js/glatitudehistory.js', __FILE__); ?>"></script><div id="gLatitudeHistoryMap_<?php echo $count; ?>" class="gLatitudeHistoryMap" style="height:<?php echo $attributes['height']; ?>px; width:<?php echo $attributes['width']; ?>px;<?php echo $customStyle; ?>"></div> <script type="text/javascript"><?php if($count == 1):?> var gLatitudeHistoryLocations = new Array(); var gLatitudeHistoryAttributes = new Array(); <?php endif;?> gLatitudeHistoryLocations[<?php echo $count; ?>] = <?php echo json_encode($latitudeHistory); ?>; gLatitudeHistoryAttributes[<?php echo $count; ?>] = <?php echo json_encode($attributes); ?>; </script> <?php 
    
    		return ob_get_clean();
    	}
    } 
    
    ?>

    Plugin Author peter2322

    (@peter2322)

    Did you pay for the Striking theme? I would like to download it and check if its causing problems. if you can provide a link to a free version that would be great. thanks.

    Thread Starter popolo512

    (@popolo512)

    Brilliant Peter.

    It’s working with the changes above. Thank you so much.

    Pass me your email address to carl@wibblywebbly.co.uk and I’ll send you a link.

    Thank you again. Carl.

    Hi Peter

    Following your instructions on how to comment
    add_action(‘wp_footer’… in google-latitude-history.php

    and how to replace
    GoogleLatitudeHistoryMap.php

    I managed to display the map but it remains empty.

    Chrome Console says:

    content script sending message          content script-0: GetToolbarStatus chrome-extension://aaaangaohdajkgeopjhpbnlpkehbhmbj/lib/tb-message.js:207
    content script received reply for       content script-0: Reply chrome-extension://aaaangaohdajkgeopjhpbnlpkehbhmbj/lib/tb-message.js:207
    content script sending message          content script-1: GetSideBySideStatus chrome-extension://aaaangaohdajkgeopjhpbnlpkehbhmbj/lib/tb-message.js:207
    content script received reply for       content script-1: Reply chrome-extension://aaaangaohdajkgeopjhpbnlpkehbhmbj/lib/tb-message.js:207
    GET http://faith-unlimited.ch/wp/wp-mail.php 500 (Internal Server Error) /wp/wp-mail.php:1

    WordPress – Settings – Google Latitude History reports the following errors:
    – Google Latitude History: Your OAuth token is stale, please refresh the token (no matter how many times I refresh the token)
    and
    – Error syncing Latitude location history: Error calling GET https://www.googleapis.com/latitude/v1/location?max-results=20&granularity=city&fields=items%28latitude%2Clongitude%2CtimestampMs%2Caccuracy%29: (403) Access Not Configured

    Any help would be appreciated.

    Cheers

    Plugin Author peter2322

    (@peter2322)

    Heres a simple test to make sure its not google.

    go to https://code.google.com/oauthplayground/ (logged into google account)

    1. select google latitude and click authorize
    2. click exchange authorization code for tokens
    3. paste the following url into the request uri textbox:
    https://www.googleapis.com/latitude/v1/location?max-results=20&granularity=city&fields=items%28latitude%2Clongitude%2CtimestampMs%2Caccuracy%29

    4. click send request

    The response should appear in green on the right hand

    If this works then the problem is either with my plugin or your web server.

    Thanks Peter,

    Some further checking has shown that Latitude API was not turned on, just the Google Map API. Definitely my issue. It now works perfectly!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Plugin: Google Latitude History] Not displaying a map’ is closed to new replies.