Пример #1
0
function cp_add_comment_to_task_handler()
{
    // Nonce check
    check_admin_referer('add-task-comment', 'nonce');
    $data = $_REQUEST['data'];
    extract($data);
    cp_insert_comment_on_task(array('comment_post_ID' => $task_id, 'comment_content' => apply_filters('cp_comment_content', wp_kses_post($comment_content))));
    $permalink = cp_get_task_permalink($task_id);
    wp_send_json_success(array('redirect' => $permalink));
}
Пример #2
0
/**
 * Filter the permalink for CollabPress post types.
 */
function cp_filter_permalinks($link, $post, $leavename, $sample)
{
    switch ($post->post_type) {
        case 'cp-projects':
            $link = cp_get_project_permalink($post->ID, $post);
            break;
        case 'cp-tasks':
            $link = cp_get_task_permalink($post->ID, $post);
            break;
    }
    return $link;
}