diff --git a/assets/js/opentools-updatecheck.js b/assets/js/opentools-updatecheck.js index 74773fcc8c7c3c0cd57d6e8c4390a04a4b2eab04..3f8f4070aaa8e16f9f2dfa098720026385a14d28 100644 --- a/assets/js/opentools-updatecheck.js +++ b/assets/js/opentools-updatecheck.js @@ -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, }; diff --git a/opentools-update-checker.php b/opentools-update-checker.php index 18adb950a8959de092a8f16f22d64a661c529ff8..b01fa1d8b1dd2cf0a9f89de7d11f840cb2aeb00d 100644 --- a/opentools-update-checker.php +++ b/opentools-update-checker.php @@ -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;