Advertisement
Guest User

Untitled

a guest
Apr 30th, 2010
1,222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1.         <?php if ( $location = bp_get_profile_field_data( 'field=Location&user_id=' . bp_displayed_user_id() ) ) : ?>
  2.         <div class="widget">
  3.             <h3 class="widgettitle">Location <?php if ( bp_is_my_profile() ) : ?>· <a href="<?php echo bp_loggedin_user_domain() .'profile/edit/' ?>">Edit</a><?php endif; ?></h3>
  4.             <script src="http://maps.google.com/maps?file=api&v=2.x&key=[YOUR API KEY]" type="text/javascript"></script>
  5.             <script type="text/javascript">
  6.  
  7.             var map = null;
  8.             var geocoder = null;
  9.  
  10.             function initialize() {
  11.               if (GBrowserIsCompatible()) {
  12.                 map = new GMap2(document.getElementById("map_canvas"));
  13.                 map.setCenter(new GLatLng(0, 0), 35);
  14.                 geocoder = new GClientGeocoder();
  15.               }
  16.             }
  17.  
  18.             function showAddress(address) {
  19.               if (geocoder) {
  20.                 geocoder.getLatLng(
  21.                   address,
  22.                   function(point) {
  23.                     if (point) {
  24.                       map.setCenter(point, 11);
  25.                       var marker = new GMarker(point);
  26.                       map.addOverlay(marker);
  27.                       map.addControl(new GSmallMapControl());
  28.                     }
  29.                   }
  30.                 );
  31.               }
  32.             }
  33.             jQuery(document).ready( function() { initialize(); showAddress('<?php echo $location ?>'); } );
  34.  
  35.             </script>
  36.  
  37.             <div id="map_canvas" style="width: 100%; height: 150px; border: 1px solid #eee; overflow: hidden"></div>
  38.         </div>
  39.         <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement