function bp_checkins_browser_header($title_and_sep, $title, $sep, $seplocation) { if (bp_checkins_if_single_place()) { $place_title = ucfirst(bp_get_checkins_slug()) . ' ' . $sep . ' Place' . $title_and_sep; $place = wp_cache_get('single_query', 'bp_checkins_single'); if (false === $place || is_null($place->query->post->ID)) { $place = new BP_Checkins_Place(); $place->get(array('p' => bp_action_variable(0))); } $place_title = apply_filters('get_the_title', $place->query->post->post_title) . ' ' . $sep . ' Place' . $title_and_sep; return $place_title; } elseif (bp_checkins_if_category_place()) { return ucfirst(bp_get_checkins_places_term_info('name', bp_action_variable(1))) . $title_and_sep; } elseif (bp_checkins_if_place_home()) { return __('Browse or Search Places', 'bp-checkins') . $title_and_sep; } elseif (bp_checkins_is_directory()) { return ucfirst(bp_get_checkins_slug()) . ' & Places ' . $sep . ' '; } else { return $title_and_sep; } }
function bp_checkins_user_is_deleted($user_id = false) { if (empty($user_id)) { return false; } $deleted_places = BP_Checkins_Place::delete(array('user_id' => $user_id)); return $deleted_places; }
/** * Update the global $post with directory data * * @since BuddyPress (1.7) */ public function single_place_dummy_post() { $place = wp_cache_get('single_query', 'bp_checkins_single'); if (false === $place) { $place = new BP_Checkins_Place(); $place->get(array('p' => bp_action_variable(0))); } bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $place->query->post->post_title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_checkins', 'post_status' => 'publish', 'is_archive' => false, 'comment_status' => 'closed', 'is_single' => true)); }
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(); }
function bp_checkins_group_changed_status($group_id = false) { global $bp; $status = $_POST['group-status']; if (empty($status) || empty($group_id)) { return false; } return BP_Checkins_Place::group_update_visibility($group_id, $status); }