Make WordPress Core


Ignore:
Timestamp:
05/25/2021 08:13:02 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Administration: Improve the message about installing the Link Manager plugin to use legacy Links screen.

This provides direct links to install and activate the plugin, if the user has the capabilities to do so, instead of just linking to plugin search results.

It also matches more closely the message about installing the Classic Editor plugin for meta boxes incompatible with the block editor.

Follow-up to [22855], [44280], [45657].

Props tw2113, peterwilsoncc, SergeyBiryukov.
Fixes #52669.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/bookmark.php

    r49487 r51011  
    342342    remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
    343343
    344     if ( $really_can_manage_links && current_user_can( 'install_plugins' ) ) {
    345         $link = network_admin_url( 'plugin-install.php?tab=search&s=Link+Manager' );
    346         /* translators: %s: URL to install the Link Manager plugin. */
    347         wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
     344    if ( $really_can_manage_links ) {
     345        $plugins = get_plugins();
     346
     347        if ( empty( $plugins['link-manager/link-manager.php'] ) ) {
     348            if ( current_user_can( 'install_plugins' ) ) {
     349                $install_url = wp_nonce_url(
     350                    self_admin_url( 'update.php?action=install-plugin&plugin=link-manager' ),
     351                    'install-plugin_link-manager'
     352                );
     353
     354                wp_die(
     355                    sprintf(
     356                        /* translators: %s: A link to install the Link Manager plugin. */
     357                        __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager plugin</a>.' ),
     358                        esc_url( $install_url )
     359                    )
     360                );
     361            }
     362        } elseif ( is_plugin_inactive( 'link-manager/link-manager.php' ) ) {
     363            if ( current_user_can( 'activate_plugins' ) ) {
     364                $activate_url = wp_nonce_url(
     365                    self_admin_url( 'plugins.php?action=activate&plugin=link-manager/link-manager.php' ),
     366                    'activate-plugin_link-manager/link-manager.php'
     367                );
     368
     369                wp_die(
     370                    sprintf(
     371                        /* translators: %s: A link to activate the Link Manager plugin. */
     372                        __( 'Please activate the <a href="%s">Link Manager plugin</a> to use the link manager.' ),
     373                        esc_url( $activate_url )
     374                    )
     375                );
     376            }
     377        }
    348378    }
    349379
Note: See TracChangeset for help on using the changeset viewer.