function bp_checkins_display_places_form_filter($class) { if (bp_checkins_is_group_places_area() || bp_checkins_is_user_area()) { return false; } else { return $class; } }
</option> <?php } ?> <?php } } ?> </select> </div> <input type="hidden" id="new-post-place-object" name="new-post-place-object" value="groups" /> <?php } elseif (bp_checkins_is_group_places_area()) { ?> <input type="hidden" id="new-place-post-object" name="new-place-post-object" value="groups" /> <input type="hidden" id="new-place-post-in" name="new-place-post-in" value="<?php bp_group_id(); ?> " /> <?php } ?> <?php do_action('bp_checkins_place_form_options'); ?>
function widget($args, $instance) { global $bp; extract($args); if (bp_checkins_is_group_places_area() || bp_checkins_is_user_area() && bp_is_current_action('places-area') || bp_checkins_if_single_place()) { return false; } if (!$instance['max_places']) { $instance['max_places'] = 5; } if (!$instance['places_type']) { $instance['places_type'] = -1; } if ($instance['dynamic'] === false) { $instance['dynamic'] = 1; } echo $before_widget; echo $before_title . $instance['title'] . $after_title; ?> <?php $widget_args = array('per_page' => $instance['max_places'], 'type' => $instance['places_type']); if ((int) $instance['dynamic'] == 1 && bp_displayed_user_id()) { $widget_args['user_id'] = bp_displayed_user_id(); } if ((int) $instance['dynamic'] == 1 && bp_is_groups_component() && bp_is_single_item() && $bp->groups->current_group->status == 'public') { $widget_args['group_id'] = $bp->groups->current_group->id; } ?> <?php if (!empty($widget_args['group_id']) || !empty($widget_args['user_id'])) { ?> <div class="item-options"> <?php if (bp_displayed_user_id()) { printf(__('%s's places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'object' => 'user', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . bp_core_get_userlink(bp_displayed_user_id())); } if (bp_is_groups_component() && bp_is_single_item()) { printf(__('%s's places', 'bp-checkins'), bp_core_fetch_avatar(array('item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'width' => 20, 'height' => 20)) . '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_attr($bp->groups->current_group->name) . '</a>'); } ?> </div> <?php } ?> <?php if (bp_checkins_has_places($widget_args)) { ?> <ul id="widget-places-list" class="item-list"> <?php while (bp_checkins_has_places()) { bp_checkins_the_place(); ?> <li> <div class="item-avatar"> <?php bp_checkins_places_avatar(); ?> </div> <div class="item-title"> <a href="<?php bp_checkins_places_the_permalink(); ?> " title="<?php bp_checkins_places_title(); ?> "><?php bp_checkins_places_title(); ?> </a> </div> <?php if (bp_checkins_places_is_live()) { ?> <div class="item-meta"> <span class="activity"><?php bp_checkins_places_live_status(); ?> </span> </div> <?php } ?> <div class="clear"></div> </li> <?php } ?> <?php } else { ?> <div class="widget-error"> <p><?php _e('Sorry, there was no places found.', 'bp-checkins'); ?> </p> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
function bp_checkins_has_places($args = '') { global $bp, $places_template; $place_in_cache = false; // This keeps us from firing the query more than once if (empty($places_template)) { /*** * Set the defaults for the parameters you are accepting via the "bp_checkins_has_places()" * function call */ $defaults = array('id' => false, 'p' => false, 'group_id' => false, 'user_id' => false, 'per_page' => 10, 'paged' => 1, 'type' => false, 'places_category' => false, 'src' => false); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (bp_checkins_is_group_places_area()) { $group_id = $bp->groups->current_group->id; } else { if (bp_action_variable(0) && bp_action_variable(0) != "category") { $p = bp_action_variable(0); $place = wp_cache_get('single_query', 'bp_checkins_single'); if (false !== $place && $place->query->post->post_name == $p) { $place_in_cache = $place; } } else { if (false !== wp_cache_get('single_query', 'bp_checkins_single')) { wp_cache_delete('single_query', 'bp_checkins_single'); } } if (bp_action_variable(0) && bp_action_variable(0) == "category" && bp_action_variable(1)) { $places_category = bp_action_variable(1); } if (bp_checkins_is_user_area() && bp_is_current_action('places-area')) { $user_id = $bp->displayed_user->id; } } if (empty($place_in_cache)) { $places_template = new BP_Checkins_Place(); if (!empty($src)) { $places_template->get(array('per_page' => $per_page, 'search' => $src)); } else { $places_template->get(array('id' => $id, 'p' => $p, 'group_id' => $group_id, 'user_id' => $user_id, 'per_page' => $per_page, 'paged' => $paged, 'type' => $type, 'places_category' => $places_category)); } } else { $places_template = $place_in_cache; } } return $places_template->have_posts(); }