function frontier_execute_delete_post($frontier_post_shortcode_parms = array())
{
    extract($frontier_post_shortcode_parms);
    //$post_task 		= isset($_GET['task']) ? $_GET['task'] : "notaskset";
    //$post_action 	= isset($_REQUEST['action']) ? $_REQUEST['action'] : "Unknown";
    if (isset($_POST['task'])) {
        $post_task = $_POST['task'];
    } else {
        if (isset($_GET['task'])) {
            $post_task = $_GET['task'];
        } else {
            $post_task = "notaskset";
        }
    }
    $post_action = isset($_POST['action']) ? $_POST['action'] : "Unknown";
    $submit_delete = isset($_POST['submit_delete']) ? $_POST['submit_delete'] : "Unknown";
    $postid = isset($_POST['postid']) ? $_POST['postid'] : 0;
    if ($post_action == "wpfrtp_delete_post" && $postid != 0) {
        if (!wp_verify_nonce($_POST['frontier_delete_post_' . $_POST['postid']], 'frontier_delete_post')) {
            wp_die(__("Security violation (Nonce check) - Please contact your Wordpress administrator", "frontier-post"));
        }
        $thispost = get_post($postid);
        //double check current user is equal to author (in case directly with param)
        if (($submit_delete = "deletego") && frontier_can_delete($thispost) == true) {
            //Move post to recycle bin
            $tmp_title = $thispost->post_title;
            wp_trash_post($_REQUEST['postid']);
            frontier_post_set_msg(__("Post deleted", "frontier-post") . ": " . $tmp_title);
            frontier_user_post_list($frontier_post_shortcode_parms);
        }
    }
}
示例#2
0
function frontier_post_delete_link($fp_post, $fp_show_icons = true, $tmp_plink, $tmp_class = '')
{
    $fp_return = '';
    if (frontier_can_delete($fp_post) == true) {
        $concat = get_option("permalink_structure") ? "?" : "&";
        if ($fp_show_icons) {
            $fp_return = '<a class="frontier-post-list-icon ' . $tmp_class . '" id="frontier-post-list-icon-delete" href="' . $tmp_plink . $concat . 'task=delete&postid=' . $fp_post->ID . '">' . frontier_get_icon('delete', $tmp_class) . '</a>';
        } else {
            $fp_return = '<a class="frontier-post-list-text ' . $tmp_class . '" id="frontier-post-list-text-delete" href="' . $tmp_plink . $concat . 'task=delete&postid=' . $fp_post->ID . '">' . __("Delete", "frontier-post") . '&nbsp;&nbsp;</a>';
        }
    }
    return $fp_return;
}