WordPress.org

Make WordPress Core

Ticket #22569: 22569.4.diff

File 22569.4.diff, 1.8 KB (added by nacin, 6 years ago)
  • wp-admin/includes/bookmark.php

     
    266266
    267267        return wp_insert_link( $linkdata );
    268268}
     269
     270/**
     271 * @since 3.5.0
     272 * @access private
     273 */
     274function wp_link_manager_disabled_message() {
     275        global $pagenow;
     276        if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow )
     277                return;
     278
     279        add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     280        $really_can_manage_links = current_user_can( 'manage_links' );
     281        remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     282
     283        if ( $really_can_manage_links && current_user_can( 'install_plugins' ) ) {
     284                $link = network_admin_url( 'plugin-install.php?tab=search&s=Link+Manager' );
     285                wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
     286        }
     287
     288        wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
     289}
     290add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );
  • wp-admin/link.php

     
    1515wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
    1616
    1717if ( ! current_user_can('manage_links') )
    18         wp_die( __('You do not have sufficient permissions to edit the links for this site.') );
     18        wp_link_manager_disabled_message();
    1919
    2020if ( !empty($_POST['deletebookmarks']) )
    2121        $action = 'deletebookmarks';