/** * Postback handling for ProjectManager */ function afmng_menu_projectmng_postback() { switch ($_POST["action"]) { case 'add_project': afmng_project_add($_POST["anime_name"]); break; case 'update_project': afmng_project_update($_POST["project_id"], $_POST["anime_name"], isset($_POST['completed']), isset($_POST['licensed'])); break; case 'add_release': afmng_db_release_add($_POST["project_id"], $_POST["episode_no"], $_POST["episode_title"]); break; case 'episode_update': afmng_db_release_update($_POST["release_id"], $_POST["episode_no"], $_POST["episode_title"]); break; } }
function wp_ajax_project_clear_status() { //accept task for current user $project_id = $_POST['project_id']; try { afmng_project_update($project_id, null, false, false); ob_clean(); echo json_encode(true); die; } catch (Exception $e) { $res = array("error" => true, msg => $e->getMessage()); ob_clean(); echo json_encode($res); die; } }