コード例 #1
0
function bp_checkins_is_single_place()
{
    global $wp_query;
    if (bp_checkins_if_single_place()) {
        $wp_query->is_404 = false;
        $wp_query->is_singular = true;
        return true;
    } else {
        return false;
    }
}
コード例 #2
0
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()) . ' &amp Places ' . $sep . ' ';
    } else {
        return $title_and_sep;
    }
}
コード例 #3
0
    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&#039;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&#039;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 
    }
コード例 #4
0
function bp_checkins_reset_post_data()
{
    if (bp_checkins_if_single_place()) {
        remove_filter('bp_force_comment_status', 'bp_chekins_allow_comments', 1);
    }
    wp_reset_postdata();
}