function process_delete_action() { $track = isset($_GET['track']) ? $_GET['track'] : ''; $track_id = isset($_GET['id']) ? $_GET['id'] : ''; if ('delete' === $this->current_action()) { //check if the individual delete link was clicked if ($_GET['track'] != '') { //get soundcloud options $sc_options = get_option('soundcloud_settings'); if ($sc_options) { $sc_id = $sc_options['sc_client_id']; $sc_secret = $sc_options['sc_client_secret']; $sc_token = $sc_options['sc_client_access_token']; $sc_redirect_uri = $sc_options['sc_redirect_uri']; } $soundcloud = new Services_Soundcloud($sc_id, $sc_secret, $sc_redirect_uri); if ($sc_token) { $soundcloud->setAccessToken($sc_token); } else { //TODO display an error stating that the user needs to authenticate first return 0; } try { $response = $soundcloud->delete('tracks/' . $track_id); return 1; } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { exit($e->getMessage()); } echo '<div id="message" class="updated fade"><p>The track "' . $track . '" was deleted from your SoundCloud account.</p></div>'; } } }