Skip to content
Snippets Groups Projects
Commit 3aaca9b3 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Fix entering update credentials when multiple OpenTools plugins are enabled

parent 8f41c266
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ var showUpdateCredentialsRow = function (btn) {
type: "POST",
url: ajaxurl,
data: {
action: 'getUpdateCredentialsRow',
action: 'getUpdateCredentialsRow_'+slug,
slug: slug,
_ajax_nonce: nonce
},
......@@ -32,7 +32,7 @@ var submitUpdateCredentials = function(btn) {
var tr = jQuery(btn).closest('tr');
var data = {
action: 'submitUpdateCredentials',
action: 'submitUpdateCredentials_'+slug,
slug: slug,
_ajax_nonce: nonce,
};
......
......@@ -42,8 +42,8 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
// add_filter('plugin_row_meta', array($this, 'displayUpdateCredentialsLink'), 9, 2);
add_filter('plugin_action_links_'.$this->pluginFile, array($this, 'displayUpdateCredentialsLink'), 9, 2);
add_action( 'wp_ajax_getUpdateCredentialsRow', array( &$this, 'getUpdateCredentialsRow') );
add_action( 'wp_ajax_submitUpdateCredentials', array( &$this, 'submitUpdateCredentials') );
add_action( 'wp_ajax_getUpdateCredentialsRow_'.$this->slug, array( &$this, 'getUpdateCredentialsRow') );
add_action( 'wp_ajax_submitUpdateCredentials_'.$this->slug, array( &$this, 'submitUpdateCredentials') );
}
protected function getCredentials($slug)
......@@ -128,11 +128,20 @@ class OpenToolsPluginUpdateChecker extends PluginUpdateChecker_2_1 {
return;
}
$json['showCredentials'] = $showCredentials;
$json['issetSLUG'] = isset($_REQUEST['slug']);
$json['SLUGmatches'] = $_REQUEST['slug'] == $this->slug;
$json['userCanUpdatePlugins'] = current_user_can('update_plugins');
$json['checkAjax'] = check_ajax_referer('otup_enter_update_credentials');
$json['NotEmptyCredVars'] = !empty($this->credvars);
$json['IsNetworkAdmin'] = is_network_admin();
$json['isMultisite'] = is_multisite();
$showCredentials = isset($_REQUEST['slug'])
&& $_REQUEST['slug'] == $this->slug
&& current_user_can('update_plugins')
&& check_ajax_referer('otup_enter_update_credentials');
$showCredentials = $showCredentials && !empty($this->credvars);
&& check_ajax_referer('otup_enter_update_credentials')
&& !empty($this->credvars);
if ( $showCredentials && (is_network_admin() || !is_multisite() )) {
$slug = $this->slug;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment