Title: problem api
Last modified: August 30, 2016

---

# problem api

 *  Resolved [alexdex](https://wordpress.org/support/users/alexdex/)
 * (@alexdex)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/)
 * Hi i love your plugin but i have this error in the buddypress activity and profile:
 * You have included the Google Maps API multiple times on this page. This may cause
   unexpected errors.
 * Can you help me?
 * [https://wordpress.org/plugins/geodirectory/](https://wordpress.org/plugins/geodirectory/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Paolo](https://wordpress.org/support/users/paoltaia/)
 * (@paoltaia)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706485)
 * Hi,
 * that is normally caused by the theme or another plugin including the Google Maps
   API too.
 * Most theme and plugins have options to remove it. Our doesn’t because it totally
   relies on it.
 * Let us know if you can’t find the culprit and we will investigate. we’ll need
   access to your website to do so, so we suggest to register on our forum and submit
   your request on it, were you can also send us private replies to keep URL and
   credentials confidentials.
 * Thanks
 *  Thread Starter [alexdex](https://wordpress.org/support/users/alexdex/)
 * (@alexdex)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706499)
 * Hi. I do it, the plugin that create the error is bp checkins. I need absolute
   to use it because give me the possibility to autodetect the user position and
   post in buddypress activity. I see that this function miss in your plugin and
   I search a lot a plugin for this function and I found only this. Please can you
   help me for solve the conflict? I see plugin have no option for disable, I found
   the PHP that call the scripts, I try to delete but of course do not work. I am
   not skill in PHP but the problem it is in about 20 code line, I need your help
   please
 *  Thread Starter [alexdex](https://wordpress.org/support/users/alexdex/)
 * (@alexdex)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706504)
 * Here the code:
 * function bp_checkins_load_gmap3() {
    if( bp_checkins_is_activity_or_friends()
   || bp_checkins_is_directory() || bp_checkins_is_group_checkins_area() ) { wp_enqueue_script(‘
   google-maps’, ‘[http://maps.google.com/maps/api/js?sensor=false&#8217](http://maps.google.com/maps/api/js?sensor=false&#8217););
   wp_enqueue_script( ‘gmap3’, BP_CHECKINS_PLUGIN_URL_JS . ‘/gmap3.min.js’, array(‘
   jquery’) );
 *  wp_enqueue_style( ‘bpcistyle’, BP_CHECKINS_PLUGIN_URL_CSS . ‘/bpcinstyle.css’);
 *  if( !empty( $_GET[‘map’] ) && $_GET[‘map’] == 1 ) {
    global $bpci_lat, $bpci_lng;
   $bpci_lat = bp_activity_get_meta( bp_current_action(), ‘bpci_activity_lat’ );
   $bpci_lng = bp_activity_get_meta( bp_current_action(), ‘bpci_activity_lng’ );
 *  if( !empty( $bpci_lat ) && !empty( $bpci_lng ) ) {
    add_action(‘wp_head’, ‘bp_checkins_item_map’);}}
   elseif( bp_checkins_show_friends_checkins() ){ wp_enqueue_script( ‘bp-ckeckins-
   friends’, BP_CHECKINS_PLUGIN_URL_JS . ‘/bp-checkins-friends.js’ ); } else {
 *  if( bp_checkins_is_directory() || bp_checkins_is_group_checkins_area() ) {
    
   wp_enqueue_script( ‘bp-ckeckins-dir’, BP_CHECKINS_PLUGIN_URL_JS . ‘/bp-checkins-
   dir.js’ ); bp_checkins_localize_script(‘dir’); } else { wp_enqueue_script( ‘bp-
   ckeckins’, BP_CHECKINS_PLUGIN_URL_JS . ‘/bp-checkins.js’ ); bp_checkins_localize_script(‘
   activity’); }
 *  }
 *  if( bp_is_single_activity() ){
    add_action(‘wp_footer’, ‘bp_checkins_img_trick’);}}
 *  if( bp_displayed_user_id() && bp_is_settings_component() && bp_is_current_action(‘
   checkins-settings’) ){
    wp_enqueue_style( ‘bpcistyle’, BP_CHECKINS_PLUGIN_URL_CSS.‘/
   bpcinstyle.css’); } }
 * add_action(‘bp_actions’, ‘bp_checkins_load_gmap3’);
 * function bp_checkins_item_map() {
    global $bpci_lat, $bpci_lng; ?> <script type
   =”text/javascript”> jQuery(document).ready(function($){ var bpciPosition = new
   google.maps.LatLng(<?php echo $bpci_lat;?>,<?php echo $bpci_lng;?>);
 *  adresse = $(“.update-checkin”).html();
 *  $(“.activity-checkin”).append(‘<div id=”bpci-map”></div>’);
    $(“.activity-checkin”).
   css(‘width’,’100%’);
 *  $(“#bpci-map”).gmap3({
    action: ‘addMarker’, latLng:bpciPosition, map:{ center:
   true, zoom: 16 } }, { action : ‘clear’, name: ‘marker’ }, { action:’addOverlay’,
   latLng: bpciPosition, options:{ content: ‘<div class=”bpci-avatar”><s></s><i>
   </i><span>’ + $(“.activity-avatar”).html() + ‘</span></div>’, offset:{ y:-40,
   x:10 } } }); });
 *  </script>
    <?php }
 * function bp_checkins_record_group_geoloc_meta( $content, $user_id, $group_id,
   $activity_id ) {
    bp_checkins_record_geoloc_meta( $content, $user_id, $activity_id);}
 * function bp_checkins_record_geoloc_meta( $content, $user_id, $activity_id ){
 *  /* javascript disabled */
    if( isset( $_POST[‘bpci-lat’] ) ) { $lat = $_POST[‘
   bpci-lat’]; $lng = $_POST[‘bpci-lng’]; $address = $_POST[‘bpci-address’]; } else{
   if ( !empty( $_POST[‘cookie’] ) ) $_BP_COOKIE = wp_parse_args( str_replace( ‘;‘,‘&’,
   urldecode( $_POST[‘cookie’] ) ) ); else $_BP_COOKIE = &$_COOKIE;
 *  if( $_BP_COOKIE[‘bp-ci-data-delete’] == “delete”)
    return false;
 *  if( strlen( $_BP_COOKIE[‘bp-ci-data’] ) < 2 )
    return false;
 *  $geotable = explode(‘|’, $_BP_COOKIE[‘bp-ci-data’] );
    $lat = $geotable[0]; 
   $lng = $geotable[1]; $address = $geotable[2]; }
 *  if( !empty($lat) && !empty($lng) && !empty($address) ) {
 *  // let’s add some meta to activity
    bp_activity_update_meta( $activity_id, ‘
   bpci_activity_lat’, $lat ); bp_activity_update_meta( $activity_id, ‘bpci_activity_lng’,
   $lng ); bp_activity_update_meta( $activity_id, ‘bpci_activity_address’, $address);
 *  $check_activity_array = bp_activity_get_specific( array( ‘activity_ids’ => $
   activity_id ) );
 *  $check_activity = $check_activity_array[‘activities’][0];
 *  /* if the activity is new_place or solo comment place, we should not update 
   the user’s last position */
    if( !in_array( $check_activity->type, array(‘new_place’,‘
   place_comment’) ) ) { // let’s update latest user’s position for ‘show my friends
   on map’ feature bp_update_user_meta( $user_id, ‘bpci_latest_lat’, $lat ); bp_update_user_meta(
   $user_id, ‘bpci_latest_lng’, $lng ); bp_update_user_meta( $user_id, ‘bpci_latest_address’,
   $address ); }
 *  /* as we have the activity, let’s rename the type of the activity to activity_checkin
   if it’s a regular activity_update */
    if( $check_activity->type == “activity_update”&&(
   int)bp_get_option( ‘bp-checkins-activate-component’ ) ) { bp_checkins_update_to_checkin_type(
   $activity_id, $check_activity );
 *  }
 *  }
 * }
    ?>
 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706528)
 * Hello,
 * Please try adding this to your child theme functions.php file
 *     ```
       function my_dequeue_script() {
          wp_dequeue_script( 'google-maps' );
       }
       add_action( 'wp_print_scripts', 'my_dequeue_script', 100 );
       ```
   
 * Thanks,
 * Stiofan
 *  Thread Starter [alexdex](https://wordpress.org/support/users/alexdex/)
 * (@alexdex)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706533)
 * Hi, i rty and now the error in consolle change, i have this:
 * Uncaught ReferenceError: google is not defined
    bp-checkins.js:24 Uncaught TypeError:
   $(…).gmap3 is not a function
 * This is the line of the error:
 *  $(‘#bpci-position-inputs’).gmap3({
    action : ‘geoLatLng’, callback : function(
   latLng){ if(latLng){ position = latLng; $(this).gmap3({ action:’getAddress’, 
   latLng:latLng, callback:function(results){ adresse = results && results[1] ? 
   results && results[1].formatted_address : ‘no address’; $.cookie(“bp-ci-data”,
   latLng.lat()+”|”+latLng.lng()+”|”+adresse, { path: ‘/’ }); $.cookie(“bp-ci-data-
   delete”, ”, { path: ‘/’ }); $(“#bpci-position-inputs”).html(‘<input type=”hidden”
   name=”bpci-lat” id=”bpci-lat” value=”‘+latLng.lat()+'”><input type=”hidden” name
   =”bpci-lng” id=”bpci-lng” value=”‘+latLng.lng()+'”><input type=”text” readonly
   value=”‘+adresse+'” id=”bpci-address” name=”bpci-address” placeholder=”‘+bp_checkins_vars.
   addressPlaceholder+'”>[<span>’+buttonTitle+'</span>](https://wordpress.org/support/topic/problem-api/?output_format=md#)
   [<span>’+bp_checkins_vars.modCheckinTitle+'</span>](https://wordpress.org/support/topic/problem-api/?output_format=md#)
   [<span>’+bp_checkins_vars.resetCheckinTitle+'</span>](https://wordpress.org/support/topic/problem-api/?output_format=md#)
   <div id=”bpci-map” class=”map-hide”></div>’); } }); } else { buttonAction = ‘
   search’; buttonTitle = bp_checkins_vars.addMapSrcTitle; $(“#bpci-position-inputs”).
   html(‘<input type=”hidden” name=”bpci-lat” id=”bpci-lat”><input type=”hidden”
   name=”bpci-lng” id=”bpci-lng”><input type=”text” id=”bpci-address” name=”bpci-
   address” placeholder=”‘+bp_checkins_vars.addressPlaceholder+'”>[<span>’+buttonTitle+'</span>](https://wordpress.org/support/topic/problem-api/?output_format=md#)
   [<span>’+bp_checkins_vars.modCheckinTitle+'</span>](https://wordpress.org/support/topic/problem-api/?output_format=md#)
   [<span>’+bp_checkins_vars.resetCheckinTitle+'</span>](https://wordpress.org/support/topic/problem-api/?output_format=md#)
   <div id=”bpci-map” class=”map-hide”></div>’); alert(bp_checkins_vars.html5LocalisationError);
   $(“#bpci-address”).focus(); } } });
 *  }
 *  return false;
    });
 * thanks for your big help
 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706534)
 * ok, i don’t think this is something that will be solved though back and fourth
   messages like this, can you please start a new support topic on our support forum
   where you will then be able to send us login details in private so we can take
   a look ourselves?
    [https://wpgeodirectory.com/support/forum/geodirectory-core-plugin-forum/plugin-support/](https://wpgeodirectory.com/support/forum/geodirectory-core-plugin-forum/plugin-support/)
 * Thanks,
 * Stiofan
 *  Thread Starter [alexdex](https://wordpress.org/support/users/alexdex/)
 * (@alexdex)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706543)
 * Hi, finally i found the solution after long time. The author of bp check-in plugin
   post the small code to add to the theme function but Was for another plugin that
   load the script:
 *  i simply added these lines to the functions.php of my active theme and it seems
   to fix the problem :
 * function imath_avoid_conflict_error_gtm_events_manager(){
    /* If map is required
   and gtm is hooking wp_print_scripts then, i remove this hook. */ if( isset( $
   _GET[‘map’] ) && has_action( ‘wp_print_scripts’, ‘bp_gtm_js_groups_all’ ) ) {
   remove_action(‘wp_print_scripts’, ‘bp_gtm_js_groups_all’); } }
 * add_action(‘bp_actions’, ‘imath_avoid_conflict_error_gtm_events_manager’);
 * Please can you help me to adapt the script relative to your plugin?
    Thank you
   so much
 *  Plugin Author [Paolo](https://wordpress.org/support/users/paoltaia/)
 * (@paoltaia)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706546)
 * Hi,
 * as Stiofan asked, please register in our forum where you can share link and credentials
   in private with forum moderator…
 * It will take much less time for us to figure out how to fix your problem if we
   can do our debugging directly.
 * Thank you

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘problem api’ is closed to new replies.

 * ![](https://ps.w.org/geodirectory/assets/icon-256x256.jpg?rev=2778361)
 * [GeoDirectory - WP Business Directory Plugin and Classified Listings Directory](https://wordpress.org/plugins/geodirectory/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geodirectory/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geodirectory/)
 * [Active Topics](https://wordpress.org/support/plugin/geodirectory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geodirectory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geodirectory/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Paolo](https://wordpress.org/support/users/paoltaia/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/problem-api/#post-6706546)
 * Status: resolved