/** * Function and action for publishing or unpublishing single products */ function wpsc_ajax_toggle_published() { $product_id = absint($_GET['product']); check_admin_referer('toggle_publish_' . $product_id); $status = wpsc_toggle_publish_status($product_id) ? 'true' : 'false'; $sendback = add_query_arg('flipped', "1", wp_get_referer()); wp_redirect($sendback); exit; }
/** * Called from javascript within product page to toggle publish status - AJAX * @return bool publish status */ function wpsc_ajax_toggle_publish() { /** * @todo - Check Admin Referer * @todo - Check Permissions */ $status = wpsc_toggle_publish_status($_REQUEST['productid']) ? 'true' : 'false'; exit($status); }