WordPress.org

Make WordPress Core

Ticket #22569: 22569.2.diff

File 22569.2.diff, 3.7 KB (added by nacin, 6 years ago)
  • wp-admin/link-add.php

     
    99/** Load WordPress Administration Bootstrap */
    1010require_once('./admin.php');
    1111
    12 if ( ! current_user_can('manage_links') )
    13         wp_die(__('You do not have sufficient permissions to add links to this site.'));
     12add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     13$really_can_manage_links = current_user_can( 'manage_links' );
     14remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
    1415
     16if ( ! current_user_can( 'manage_links' ) ) {
     17        if ( $really_can_manage_links ) {
     18                if ( current_user_can( 'install_plugins' ) )
     19                        $link = network_admin_url( 'plugin-install.php?tab=search&s=Link+Manager' );
     20                else
     21                        $link = 'http://wordpress.org/extend/plugins/link-manager/';
     22
     23                wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
     24        }
     25
     26        wp_die( __( 'You do not have sufficient permissions to add links to this site.' ) );
     27}
     28
    1529$title = __('Add New Link');
    1630$parent_file = 'link-manager.php';
    1731
  • wp-admin/link.php

     
    1212/** Load WordPress Administration Bootstrap */
    1313require_once ('admin.php');
    1414
     15add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     16$really_can_manage_links = current_user_can( 'manage_links' );
     17remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     18
     19if ( ! current_user_can( 'manage_links' ) ) {
     20        if ( $really_can_manage_links ) {
     21                if ( current_user_can( 'install_plugins' ) )
     22                        $link = network_admin_url( 'plugin-install.php?tab=search&amp;s=Link+Manager' );
     23                else
     24                        $link = 'http://wordpress.org/extend/plugins/link-manager/';
     25
     26                wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
     27        }
     28
     29        wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
     30}
     31
    1532wp_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[]'));
    1633
    17 if ( ! current_user_can('manage_links') )
    18         wp_die( __('You do not have sufficient permissions to edit the links for this site.') );
    19 
    2034if ( !empty($_POST['deletebookmarks']) )
    2135        $action = 'deletebookmarks';
    2236if ( !empty($_POST['move']) )
  • wp-admin/link-manager.php

     
    88
    99/** Load WordPress Administration Bootstrap */
    1010require_once ('admin.php');
    11 if ( ! current_user_can( 'manage_links' ) )
     11
     12add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     13$really_can_manage_links = current_user_can( 'manage_links' );
     14remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
     15
     16if ( ! current_user_can( 'manage_links' ) ) {
     17        if ( $really_can_manage_links ) {
     18                if ( current_user_can( 'install_plugins' ) )
     19                        $link = network_admin_url( 'plugin-install.php?tab=search&amp;s=Link+Manager' );
     20                else
     21                        $link = 'http://wordpress.org/extend/plugins/link-manager/';
     22
     23                wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
     24        }
     25
    1226        wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
     27}
    1328
    1429$wp_list_table = _get_list_table('WP_Links_List_Table');
    1530