Make WordPress Core

Changeset 51011


Ignore:
Timestamp:
05/25/2021 08:13:02 PM (5 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.

Location:
trunk/src/wp-admin/includes
Files:
2 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
  • trunk/src/wp-admin/includes/template.php

    r50795 r51011  
    11491149        if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) {
    11501150                if ( current_user_can( 'install_plugins' ) ) {
     1151                        $install_url = wp_nonce_url(
     1152                                self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ),
     1153                                'save_wporg_username_' . get_current_user_id()
     1154                        );
     1155
    11511156                        echo '<p>';
    1152                         printf(
    1153                                 /* translators: %s: A link to install the Classic Editor plugin. */
    1154                                 __( 'Please install the <a href="%s">Classic Editor plugin</a> to use this meta box.' ),
    1155                                 esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ) )
    1156                         );
     1157                        /* translators: %s: A link to install the Classic Editor plugin. */
     1158                        printf( __( 'Please install the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $install_url ) );
    11571159                        echo '</p>';
    11581160                }
    11591161        } elseif ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) {
    11601162                if ( current_user_can( 'activate_plugins' ) ) {
    1161                         $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ), 'activate-plugin_classic-editor/classic-editor.php' );
     1163                        $activate_url = wp_nonce_url(
     1164                                self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ),
     1165                                'activate-plugin_classic-editor/classic-editor.php'
     1166                        );
     1167
    11621168                        echo '<p>';
    11631169                        /* translators: %s: A link to activate the Classic Editor plugin. */
Note: See TracChangeset for help on using the changeset viewer.