function bp_checkins_places_comment_can_delete()
{
    $can_delete = bp_checkins_places_user_can_delete();
    return apply_filters('bp_checkins_places_comment_can_delete', $can_delete);
}
Пример #2
0
function bp_checkins_place_delete()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Check the nonce
    check_admin_referer('bp_checkins_place_delete_link');
    if (!is_user_logged_in()) {
        echo '-1';
        return false;
    }
    if (empty($_POST['place_id']) || !is_numeric($_POST['place_id'])) {
        echo '-1';
        return false;
    }
    $place = new BP_Checkins_Place((int) $_POST['place_id']);
    if (empty($place->query->post->post_author) || !bp_checkins_places_user_can_delete($place->query->post)) {
        echo '-1';
        return false;
    }
    do_action('bp_checkins_before_place_delete', $place->query->post->ID);
    $notice = bp_checkins_delete_place($place->query->post->ID);
    if (!$notice || $notice['type'] != 'updated') {
        echo '-1<div id="message" class="error"><p>' . $notice['message'] . '</p></div>';
        return false;
    }
    do_action('bp_checkins_after_place_delete', $place->query->post->ID);
    return true;
    exit;
}
                bp_get_checkins_places_comment_link();
                ?>
" class="button bp-primary-action" id="comment-<?php 
                bp_checkins_places_id();
                ?>
"><?php 
                printf(__('Checkin <span>%s</span> &amp; Comment <span>%s</span>', 'bp-checkins'), bp_checkins_places_get_checkins_count(), bp_checkins_places_get_comment_count());
                ?>
</a>

								<?php 
            }
            ?>

								<?php 
            if (bp_checkins_places_user_can_delete()) {
                bp_checkins_places_delete_link();
            }
            ?>

								<?php 
            do_action('bp_places_single_meta');
            ?>
								
								<?php 
            bp_checkins_friends_checkedin();
            ?>

							</div>

						<?php