function cp_modify_project_users_handler()
{
    global $wpdb, $cp;
    // Nonce check
    check_admin_referer('modify-project-users', 'nonce');
    $data = $_REQUEST['data'];
    extract($data);
    $wpdb->query($wpdb->prepare("DELETE FROM {$cp->tables->project_users}\n\t\t\tWHERE project_id = %d", $project_id));
    foreach ($users as $user_id) {
        cp_add_user_to_project($project_id, $user_id);
    }
    $permalink = cp_get_project_users_permalink($project_id);
    wp_send_json_success(array('redirect' => $permalink));
}
Esempio n. 2
0
function cp_project_users_permalink($project_id = 0)
{
    echo cp_get_project_users_permalink($project_id);
}