Make WordPress Core


Ignore:
Timestamp:
01/24/2018 10:58:22 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Role/Capability: Make install_languages capability check less restrictive.

A user should still be able to have the capability, even when language packs cannot be automatically installed. The automatic installation part is separate from that now.

Props flixos90.
Merges [42606] to the 4.9 branch.
Fixes #42697.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/network/settings.php

    r41617 r42607  
    8484
    8585    // Handle translation installation.
    86     if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_languages' ) ) {
     86    if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
    8787        $language = wp_download_language_pack( $_POST['WPLANG'] );
    8888        if ( $language ) {
     
    375375                        }
    376376
    377                         wp_dropdown_languages( array(
    378                             'name'         => 'WPLANG',
    379                             'id'           => 'WPLANG',
    380                             'selected'     => $lang,
    381                             'languages'    => $languages,
    382                             'translations' => $translations,
    383                             'show_available_translations' => current_user_can( 'install_languages' ),
    384                         ) );
     377                        wp_dropdown_languages(
     378                            array(
     379                                'name'         => 'WPLANG',
     380                                'id'           => 'WPLANG',
     381                                'selected'     => $lang,
     382                                'languages'    => $languages,
     383                                'translations' => $translations,
     384                                'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(),
     385                            )
     386                        );
    385387                        ?>
    386388                    </td>
Note: See TracChangeset for help on using the changeset viewer.