function bp_links_delete_link($link_id) { global $bp; // Check the user is the link admin. if (false === bp_link_is_admin()) { return false; } // Get the link object $link = new BP_Links_Link($link_id); if (!$link->delete()) { return false; } /* Delete all link activity from activity streams */ if (function_exists('bp_activity_delete_by_item_id')) { bp_activity_delete_by_item_id(array('item_id' => $link->id, 'component_name' => bp_links_id())); } // Remove all notifications for any user belonging to this link bp_core_delete_all_notifications_by_type($link_id, bp_links_id()); do_action('bp_links_delete_link', $link_id); return true; }