Make WordPress Core


Ignore:
Timestamp:
01/24/2018 10:58:22 PM (7 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/site-new.php

    r41289 r42607  
    6969        } elseif ( in_array( $_POST['WPLANG'], get_available_languages() ) ) {
    7070            $meta['WPLANG'] = $_POST['WPLANG'];
    71         } elseif ( current_user_can( 'install_languages' ) ) {
     71        } elseif ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
    7272            $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
    7373            if ( $language ) {
     
    231231                    }
    232232
    233                     wp_dropdown_languages( array(
    234                         'name'                        => 'WPLANG',
    235                         'id'                          => 'site-language',
    236                         'selected'                    => $lang,
    237                         'languages'                   => $languages,
    238                         'translations'                => $translations,
    239                         'show_available_translations' => current_user_can( 'install_languages' ),
    240                     ) );
     233                    wp_dropdown_languages(
     234                        array(
     235                            'name'                        => 'WPLANG',
     236                            'id'                          => 'site-language',
     237                            'selected'                    => $lang,
     238                            'languages'                   => $languages,
     239                            'translations'                => $translations,
     240                            'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(),
     241                        )
     242                    );
    241243                    ?>
    242244                </td>
Note: See TracChangeset for help on using the changeset viewer.