/** * Postback Handler for MainMenu */ function afmng_menu_tasks_postback() { //check if user has the rights //if( !current_user_can( 'manage_options' ) //admin_task_add switch ($_POST["action"]) { case 'admin_task_add': afmng_db_task_add($_POST['episode'], $_POST['step'], $_POST['user']); break; } }
function wp_ajax_task_create_assign() { //accept task for current user $release_id = $_POST['release_id']; $step_id = $_POST['step_id']; try { $user = wp_get_current_user()->user_login; afmng_db_task_add($release_id, $step_id, $user); ob_clean(); echo json_encode(true); die; } catch (Exception $e) { $res = array("error" => true, msg => $e->getMessage()); ob_clean(); echo json_encode($res); die; } }