Make WordPress Core

Changeset 45043


Ignore:
Timestamp:
03/27/2019 10:10:37 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Plugins: Disable "Update Now" button for plugins that require a higher version of PHP or WordPress.

This complements disabling the "Install Now" button in [43436].

Props afragen.
Fixes #46677. See #43986.

File:
1 edited

Legend:

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

    r44936 r45043  
    538538                                        case 'update_available':
    539539                                                if ( $status['url'] ) {
    540                                                         $action_links[] = sprintf(
    541                                                                 '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
    542                                                                 esc_attr( $status['file'] ),
    543                                                                 esc_attr( $plugin['slug'] ),
    544                                                                 esc_url( $status['url'] ),
    545                                                                 /* translators: %s: plugin name and version */
    546                                                                 esc_attr( sprintf( __( 'Update %s now' ), $name ) ),
    547                                                                 esc_attr( $name ),
    548                                                                 __( 'Update Now' )
    549                                                         );
     540                                                        if ( $compatible_php && $compatible_wp ) {
     541                                                                $action_links[] = sprintf(
     542                                                                        '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
     543                                                                        esc_attr( $status['file'] ),
     544                                                                        esc_attr( $plugin['slug'] ),
     545                                                                        esc_url( $status['url'] ),
     546                                                                        /* translators: %s: plugin name and version */
     547                                                                        esc_attr( sprintf( __( 'Update %s now' ), $name ) ),
     548                                                                        esc_attr( $name ),
     549                                                                        __( 'Update Now' )
     550                                                                );
     551                                                        } else {
     552                                                                $action_links[] = sprintf(
     553                                                                        '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
     554                                                                        _x( 'Cannot Update', 'plugin' )
     555                                                                );
     556                                                        }
    550557                                                }
    551558                                                break;
Note: See TracChangeset for help on using the changeset viewer.