function bp_checkins_get_template_part($templates)
{
    if (bp_is_current_component('checkins') && !bp_checkins_is_bp_default() || bp_checkins_is_group_checkins_area() && !bp_checkins_is_bp_default()) {
        $templates[] = BP_CHECKINS_PLUGIN_DIR . '/templates/';
    }
    return $templates;
}
function bp_checkins_activity_querystring_filter($query_string, $object)
{
    // not on a checkin area, then return the query without changing it!
    if (!bp_is_current_component('checkins') && !bp_checkins_is_group_checkins_area()) {
        return $query_string;
    }
    /* Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts */
    if (!empty($_POST['cookie'])) {
        $_BP_CI_COOKIE = wp_parse_args(str_replace('; ', '&', urldecode($_POST['cookie'])));
    } else {
        $_BP_CI_COOKIE =& $_COOKIE;
    }
    $defaults = array('page' => false);
    $r = wp_parse_args($query_string, $defaults);
    extract($r, EXTR_SKIP);
    //default values to filter on
    $object = 'checkins,groups';
    $action = 'activity_checkin,foursquare_checkin,place_checkin';
    $bp_ci_qs = false;
    $bp_ci_qs[] = 'object=' . $object;
    /***
     * Check if any cookie values are set. If there are then override the default params passed to the
     * template loop
     */
    if (!empty($_BP_CI_COOKIE['bp-checkins-filter']) && '-1' != $_BP_CI_COOKIE['bp-checkins-filter'] && $_BP_CI_COOKIE['bp-checkins-filter'] != 'friends_checkin') {
        $bp_ci_qs[] = 'type=' . $_BP_CI_COOKIE['bp-checkins-filter'];
        $bp_ci_qs[] = 'action=' . $_BP_CI_COOKIE['bp-checkins-filter'];
    } else {
        $bp_ci_qs[] = 'type=' . $object;
        $bp_ci_qs[] = 'action=' . $action;
    }
    if (!empty($_BP_CI_COOKIE['bp-checkins-filter']) && '-1' != $_BP_CI_COOKIE['bp-checkins-filter'] && $_BP_CI_COOKIE['bp-checkins-filter'] == 'friends_checkin') {
        // this is my trick to transsform a filter to a scope !
        $bp_ci_qs[] = 'scope=friends';
    }
    //includes the !public group checkins
    if (bp_checkins_is_user_area() && bp_is_my_profile()) {
        $bp_ci_qs[] = 'show_hidden=1';
    }
    if (!empty($page)) {
        $bp_ci_qs[] = 'page=' . $page;
    }
    //builds the bp_checkins query
    $query_string = empty($bp_ci_qs) ? '' : join('&', (array) $bp_ci_qs);
    return apply_filters('bp_checkins_activity_querystring_filter', $query_string, $object, $action);
}
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');
        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');
    }
}
</option>
								<?php 
            }
            ?>
								
							<?php 
        }
    }
    ?>

					</select>
				</div>
				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />

			<?php 
} elseif (bp_checkins_is_group_checkins_area()) {
    ?>

				<input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" />
				<input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php 
    bp_group_id();
    ?>
" />

			<?php 
}
?>

			<?php 
do_action('bp_checkins_post_form_options');
?>