コード例 #1
0
function bp_checkins_places_home()
{
    echo bp_get_checkins_places_home();
}
コード例 #2
0
function bp_checkins_places_delete_content()
{
    if (bp_is_current_component('checkins') && bp_is_current_action('comments') && 'delete' == bp_action_variable(0)) {
        $redirect = esc_url(wp_get_referer());
        if (!bp_action_variable(1) || !is_numeric(bp_action_variable(1))) {
            bp_core_add_message(__('No comment to delete', 'bp-checkins'), 'error');
            bp_core_redirect($redirect);
        }
        check_admin_referer('bp_checkins_comment_delete_link');
        $comment_id = (int) bp_action_variable(1);
        $notice = bp_checkins_delete_place_comment($comment_id);
        if (empty($notice)) {
            bp_core_add_message(__('No comment id was given, please try again', 'bp-checkins'), 'error');
        } else {
            if (is_array($notice) && $notice['type'] == 'updated') {
                bp_core_add_message($notice['message']);
            } else {
                bp_core_add_message($notice['message'], $notice['type']);
            }
        }
        bp_core_redirect($redirect);
    }
    if (bp_is_current_component('checkins') && bp_is_current_action('places') && 'delete' == bp_action_variable(0)) {
        $redirect = bp_get_checkins_places_home();
        if (!bp_action_variable(1) || !is_numeric(bp_action_variable(1))) {
            bp_core_add_message(__('No place to delete', 'bp-checkins'), 'error');
            bp_core_redirect($redirect);
        }
        check_admin_referer('bp_checkins_place_delete_link');
        $place_id = (int) bp_action_variable(1);
        do_action('bp_checkins_before_place_delete', $place_id);
        $notice = bp_checkins_delete_place($place_id);
        if (empty($notice)) {
            bp_core_add_message(__('No place id was given, please try again', 'bp-checkins'), 'error');
        } else {
            if (is_array($notice) && $notice['type'] == 'updated') {
                bp_core_add_message($notice['message']);
            } else {
                bp_core_add_message($notice['message'], $notice['type']);
            }
        }
        do_action('bp_checkins_after_place_delete', $place_id);
        bp_core_redirect($redirect);
    }
}