WordPress.org

Make WordPress Core

Changeset 35808


Ignore:
Timestamp:
12/06/2015 10:22:11 PM (4 years ago)
Author:
helen
Message:

Plugins: Provide a link to searching the plugin directory when no search results are found.

Many new users do not know the difference between managing installed plugins and those found in the plugin directory. This helps with discoverability. The link is not provided in multisite installs because we assume that somebody with that kind of power in a network is experienced enough not to need it. This can always be reconsidered later.

props mordauk for the initial patch.
fixes #29865.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r35445 r35808  
    317317        global $plugins;
    318318
    319         if ( !empty( $plugins['all'] ) )
     319        if ( ! empty( $_REQUEST['s'] ) ) {
     320            $s = esc_html( $_REQUEST['s'] );
     321
     322            printf( __( 'No plugins found for “%s”.' ), $s );
     323
     324            // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link.
     325            if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) {
     326                echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>';
     327            }
     328        } elseif ( ! empty( $plugins['all'] ) )
    320329            _e( 'No plugins found.' );
    321330        else
Note: See TracChangeset for help on using the changeset viewer.