function wpsc_members_delete_subscription($capability) { global $wpsc_product_capability_list; if (isset($wpsc_product_capability_list[$capability])) { unset($wpsc_product_capability_list[$capability]); update_option('wpsc_product_capability_list', $wpsc_product_capability_list); remove_capabilities_from_users($capability); } wpsc_display_update('Subscription Deleted'); return; }
function wpsc_display_purchasable_capabilities() { global $wpdb; $action = $_POST['action']; if (!$action) { $action = $_GET['action']; } if ($_POST['page_action'] == 'add') { if (empty($_POST['capability_list']['new']['capability']) && empty($_POST['capability_list']['new']['name'])) { $message_flag = '<div class="error" id="message"><p><strong>OPPS</strong>. you need to enter in A name and display name for your subscription.</p></div>'; } else { $message_flag = '<div class="updated fade" id="message"><p><strong>Success</strong>. Your new subscription has been added.</p></div>'; } } ?> <div class="wrap"> <?php switch ($action) { //this case process the add new capability sav case 'new': echo '<div id="col-container" class="">'; echo '<div id="poststuff" class="col-wrap">'; display_cap_tabs(); echo $message_flag; echo '<div id="pad-left">'; echo '<p><h3>WP e-Commerce Subscriptions: Add Subscription</h3>'; echo 'Add a new Capability / Subscription to sell or apply to your users</p><br /><br />'; echo '<div id="custom-m-small">'; add_meta_box("add-purchasable-capabilities-form", __('Add A Subscription', 'wpsc'), "wpsc_add_purchasable_capabilities_forum", "wpsc"); do_meta_boxes('wpsc', 'advanced', null); echo '</div>'; //close custom m small echo '</div>'; //close pad-left echo '</div>'; //close post stuff echo '</div>'; //close col container break; wpsc_purchasable_capabilities_page(); ///edit user ///edit user case 'edit': echo '<div id="col-container" class="">'; echo '<div id="poststuff" class="col-wrap">'; display_cap_tabs(); echo '<div id="pad-left">'; echo '<h3>WP e-Commerce Subscriptions: Edit Subscription <a href="admin.php?page=wpsc_display_purchasable_capabilities&action=new" class="button add-new-h2">Add new Subscription</a></h3><br /><br />'; echo '<div id="custom-m-small">'; add_meta_box("edit-purchasable-capabilities-form", __('Edit Subscription', 'wpsc'), "wpsc_edit_purchasable_capabilities_forum", "wpsc"); do_meta_boxes('wpsc', 'advanced', null); echo '</div>'; //close custom m small echo '</div>'; //close pad-left echo '</div>'; //close post stuff echo '</div>'; //close col container break; case 'delete': global $wpdb, $wpsc_product_capability_list; $capability = $_GET['capability']; if (isset($wpsc_product_capability_list[$capability])) { unset($wpsc_product_capability_list[$capability]); update_option('wpsc_product_capability_list', $wpsc_product_capability_list); remove_capabilities_from_users($capability); } break; default: wpsc_purchasable_capabilities_page(); break; } ?> </div> <?php }