Fully implement the 'delete_themes' capability. See also r13547

git-svn-id: http://svn.automattic.com/wordpress/trunk@14984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-05-27 09:49:38 +00:00
parent c1c0effc6a
commit f0c63decb0
4 changed files with 10 additions and 9 deletions

View File

@ -612,6 +612,7 @@ function populate_roles_300() {
$role->add_cap( 'add_users' ); $role->add_cap( 'add_users' );
$role->add_cap( 'promote_users' ); $role->add_cap( 'promote_users' );
$role->add_cap( 'edit_theme_options' ); $role->add_cap( 'edit_theme_options' );
$role->add_cap( 'delete_themes' );
} }
} }

View File

@ -440,7 +440,7 @@ function upgrade_all() {
if ( $wp_current_db_version < 11958 ) if ( $wp_current_db_version < 11958 )
upgrade_290(); upgrade_290();
if ( $wp_current_db_version < 14726 ) if ( $wp_current_db_version < 14984 )
upgrade_300(); upgrade_300();
maybe_disable_automattic_widgets(); maybe_disable_automattic_widgets();
@ -1108,11 +1108,11 @@ function upgrade_290() {
function upgrade_300() { function upgrade_300() {
global $wp_current_db_version, $wpdb; global $wp_current_db_version, $wpdb;
if ( $wp_current_db_version < 14139 ) { if ( $wp_current_db_version < 14984 )
populate_roles_300(); populate_roles_300();
if ( is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
add_site_option( 'siteurl', '' ); if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
} add_site_option( 'siteurl', '' );
// 3.0-alpha nav menu postmeta changes. can be removed before release. // r13802 // 3.0-alpha nav menu postmeta changes. can be removed before release. // r13802
if ( $wp_current_db_version >= 13226 && $wp_current_db_version < 13974 ) if ( $wp_current_db_version >= 13226 && $wp_current_db_version < 13974 )

View File

@ -20,7 +20,7 @@ if ( current_user_can('switch_themes') && isset($_GET['action']) ) {
exit; exit;
} else if ( 'delete' == $_GET['action'] ) { } else if ( 'delete' == $_GET['action'] ) {
check_admin_referer('delete-theme_' . $_GET['template']); check_admin_referer('delete-theme_' . $_GET['template']);
if ( !current_user_can('update_themes') ) if ( !current_user_can('delete_themes') )
wp_die( __( 'Cheatin&#8217; uh?' ) ); wp_die( __( 'Cheatin&#8217; uh?' ) );
delete_theme($_GET['template']); delete_theme($_GET['template']);
wp_redirect('themes.php?deleted=true'); wp_redirect('themes.php?deleted=true');
@ -193,8 +193,8 @@ foreach ( $cols as $col => $theme_name ) {
$actions = array(); $actions = array();
$actions[] = '<a href="' . $activate_link . '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>'; $actions[] = '<a href="' . $activate_link . '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>';
$actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $theme_name)) . '">' . __('Preview') . '</a>'; $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $theme_name)) . '">' . __('Preview') . '</a>';
if ( current_user_can('update_themes') ) if ( current_user_can('delete_themes') )
$actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "if ( confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete."), $theme_name )) . "') ) {return true;}return false;" . '">' . __('Delete') . '</a>'; $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "return confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete."), $theme_name )) . "');" . '">' . __('Delete') . '</a>';
$actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]);
$actions = implode ( ' | ', $actions ); $actions = implode ( ' | ', $actions );

View File

@ -15,7 +15,7 @@ $wp_version = '3.0-beta2-14960';
* *
* @global int $wp_db_version * @global int $wp_db_version
*/ */
$wp_db_version = 14726; $wp_db_version = 14984;
/** /**
* Holds the TinyMCE version * Holds the TinyMCE version