Make WordPress Core

Changeset 57769

Timestamp:
03/05/2024 06:25:22 AM (5 months ago)
Author:
desrosj
Message:

Plugins: Improve plugin dependency admin notices.

This makes several refinements to the various notices displayed in the WordPress admin related to plugin dependencies. Additionally, it adds some conditions to display more appropriate messages for multisite installs with proper context to the user’s capabilities.

Props costdev, joedolson, afragen, swissspidy, peterwilsoncc, euthelup.
Fixes #60465.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r57714 r57769  
    15681568        }
    15691569
    1570         $dependency_note = __( 'Note: This plugin cannot be activated until the plugins that are required by it are activated.' );
    1571 
    1572         $comma    = wp_get_list_item_separator();
    1573         $requires = sprintf(
     1570        $is_active = is_multisite() ? is_plugin_active_for_network( $dependent ) : is_plugin_active( $dependent );
     1571        $comma     = wp_get_list_item_separator();
     1572        $requires  = sprintf(
    15741573            /* translators: %s: List of dependency names. */
    15751574            __( '<strong>Requires:</strong> %s' ),
     
    15771576        );
    15781577
     1578
     1579
     1580
     1581
     1582
     1583
     1584
     1585
     1586
     1587
     1588
     1589
     1590
     1591
     1592
     1593
     1594
    15791595        printf(
    15801596            '<div class="requires"><p>%1$s</p><p>%2$s</p></div>',
    15811597            $requires,
    1582             $dependency_note
     1598            $e
    15831599        );
    15841600    }
  • trunk/src/wp-includes/class-wp-plugin-dependencies.php

    r57736 r57769  
    370370    public static function display_admin_notice_for_unmet_dependencies() {
    371371        if ( in_array( false, self::get_dependency_filepaths(), true ) ) {
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
    372392            wp_admin_notice(
    373                 __( 'There are additional plugin dependencies that must be installed.' ),
     393                ,
    374394                array(
    375                     'type' => 'info',
     395                    'type' => '',
    376396                )
    377397            );
Note: See TracChangeset for help on using the changeset viewer.