/** * Admin manage all links action * * @return boolean */ function bp_links_admin_manage_links() { if (isset($_POST['links_admin_delete']) && isset($_POST['alllinks'])) { if (!check_admin_referer('bp-links-admin')) { return false; } $errors = false; foreach ($_POST['alllinks'] as $link_id) { if (!bp_links_delete_link($link_id)) { $errors = true; } } if ($errors) { $message = __('There were errors when deleting links.', 'buddypress-links') . ' ' . __('Please try again.', 'buddypress-links'); $type = 'error'; } else { $message = __('Links deleted successfully', 'buddypress-links'); $type = 'updated'; } } require_once BP_LINKS_ADMIN_THEME_DIR . '/link-manager.php'; return true; }
/** * Load Link home page delete link template, handle form if submitted */ function bp_links_screen_link_admin_delete_link() { global $bp; if (false === bp_link_is_admin()) { return false; } if ('delete-link' != bp_links_admin_current_action_variable()) { return false; } if (isset($_REQUEST['delete-link-button']) && !empty($_REQUEST['delete-link-understand'])) { /* Check the nonce first. */ if (!check_admin_referer('bp_links_delete_link')) { return false; } // Link admin has deleted the link, now do it. if (bp_links_delete_link($bp->links->current_link->id)) { do_action('bp_links_link_deleted', $bp->links->current_link->id); bp_core_add_message(__('The link was deleted successfully', 'buddypress-links')); bp_core_redirect($bp->loggedin_user->domain . bp_links_slug() . '/'); } else { bp_core_add_message(__('There was an error deleting the link, please try again.', 'buddypress-links'), 'error'); } bp_core_redirect($bp->loggedin_user->domain . bp_links_slug()); } do_action('bp_links_screen_link_admin_delete_link', $bp->links->current_link->id); bp_links_load_template('single/home'); }