WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/27/2014 01:31:05 AM (7 years ago)
Author:
nacin
Message:

Plugin/Theme Uploads: New capabilities; unify UIs; ensure compatibility with old filters.

Introduce upload_plugins and upload_themes capabilities to allow blocking of plugin and theme uploads, versus the old hacky (and not secure) ways of just hiding UI tabs. These are simply meta capabilities that map to install_plugins and install_themes.

Also:

  • Use the same nice design for the plugin upload screen as the theme upload screen.
  • Better compatibility for the old install_themes_tabs filter added in [29002]. see #28578.
  • Ensure using the install_plugins_tabs filter to remove the upload tab removes the new button.
  • Use 'Add Plugins' instead of 'Install Plugins' to match 'Add Themes'.

fixes #29236.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/capabilities.php

    r29170 r29634  
    12631263    case 'delete_plugins':
    12641264    case 'install_plugins':
     1265    case 'upload_plugins':
    12651266    case 'update_themes':
    12661267    case 'delete_themes':
    12671268    case 'install_themes':
     1269    case 'upload_themes':
    12681270    case 'update_core':
    12691271        // Disallow anything that creates, deletes, or updates core, plugin, or theme files.
    12701272        // Files in uploads are excepted.
    1271         if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
     1273        if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
    12721274            $caps[] = 'do_not_allow';
    1273         elseif ( is_multisite() && ! is_super_admin( $user_id ) )
     1275        } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) {
    12741276            $caps[] = 'do_not_allow';
    1275         else
     1277        } elseif ( 'upload_themes' === $cap ) {
     1278            $caps[] = 'install_themes';
     1279        } elseif ( 'upload_plugins' === $cap ) {
     1280            $caps[] = 'install_plugins';
     1281        } else {
    12761282            $caps[] = $cap;
     1283        }
    12771284        break;
    12781285    case 'activate_plugins':
Note: See TracChangeset for help on using the changeset viewer.