WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/18/2017 06:30:28 PM (3 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/menu.php

    r40390 r41268  
    3434
    3535if ( ! is_multisite() ) {
    36     if ( current_user_can( 'update_core' ) )
     36    if ( current_user_can( 'update_core' ) ) {
    3737        $cap = 'update_core';
    38     elseif ( current_user_can( 'update_plugins' ) )
     38    } elseif ( current_user_can( 'update_plugins' ) ) {
    3939        $cap = 'update_plugins';
    40     else
     40    } elseif ( current_user_can( 'update_themes' ) ) {
    4141        $cap = 'update_themes';
     42    } else {
     43        $cap = 'update_languages';
     44    }
    4245    $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php');
    4346    unset( $cap );
Note: See TracChangeset for help on using the changeset viewer.