Make WordPress Core


Ignore:
Timestamp:
08/18/2017 06:30:28 PM (9 years ago)
Author:
flixos90
Message:

Role/Capability: Introduce capabilities dedicated to installing and updating language files.

The new meta capabilities are called install_languages and update_languages. Prior to this change, there were no proper capability checks applied. Instead only the filesystem and related constants were checked, and for actual permissions a rather vague fallback was used where a user needed to have at least one of the other updating capabilities. In addition to being generally more verbose, the new capabilities make it possible for example to allow a user to update languages, but nothing else. By default they fall back to the original way of how they were handled.

Props johnbillion, flixos90.
Fixes #39677.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options.php

    r41254 r41268  
    178178
    179179                // Handle translation install.
    180                 if ( ! empty( $_POST['WPLANG'] ) && ( ! is_multisite() || is_super_admin() ) ) { // @todo: Skip if already installed
     180                if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_languages' ) ) {
    181181                        require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
    182182
    183                         if ( wp_can_install_language_pack() ) {
    184                                 $language = wp_download_language_pack( $_POST['WPLANG'] );
    185                                 if ( $language ) {
    186                                         $_POST['WPLANG'] = $language;
    187                                 }
     183                        $language = wp_download_language_pack( $_POST['WPLANG'] );
     184                        if ( $language ) {
     185                                $_POST['WPLANG'] = $language;
    188186                        }
    189187                }
Note: See TracChangeset for help on using the changeset viewer.