From b43393e9db93e8772d87778acd7c82aca02b0e82 Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 30 Jun 2012 12:19:13 +0000 Subject: [PATCH] Cap checks for links in the upgrader, for plugins. fixes #19824. git-svn-id: http://core.svn.wordpress.org/trunk@21197 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 68094e258c..14f5b73f30 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1195,9 +1195,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { 'activate_plugin' => '' . __('Activate Plugin') . '', 'plugins_page' => '' . __('Return to Plugins page') . '' ); - if ( $this->plugin_active ) - unset( $update_actions['activate_plugin'] ); - if ( ! $this->result || is_wp_error($this->result) ) + if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) ) unset( $update_actions['activate_plugin'] ); $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin); @@ -1449,9 +1447,11 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin { $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ''; if ( ! $this->result || is_wp_error($this->result) ) { + unset( $install_actions['activate_plugin'], $install_actions['network_activate'] ); + } elseif ( ! current_user_can( 'activate_plugins' ) ) { unset( $install_actions['activate_plugin'] ); - unset( $install_actions['network_activate'] ); } + $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file); if ( ! empty($install_actions) ) $this->feedback(implode(' | ', (array)$install_actions));