public
Created

Google Analytics Dashboard patches… Fix unused `$gauth` notice cause by trying to pass it when it's not been set, two possible options: `patch-1.diff` – Creates the `$gauth` object within the method using it `patch-2.diff` – Removes the conditional check re CAPTCHA completely, as it's not currently ever entered because `$gauth` is never set

  • Download Gist
patch-1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
diff --git a/gad-admin-options-ui.php b/gad-admin-options-ui.php
index 4ceae90..dc91950 100644
--- a/gad-admin-options-ui.php
+++ b/gad-admin-options-ui.php
@@ -191,8 +191,9 @@ class GADAdminOptionsUI
<?php
}
- function display_admin_handle_login_options($gauth)
+ function display_admin_handle_login_options()
{
+ $gauth = new GAuthLib('wpga-display-1.0');
?>
<div class="wrap" style="padding-top: 50px;">
diff --git a/gad-admin-options.php b/gad-admin-options.php
index e6afefb..6f98a5c 100644
--- a/gad-admin-options.php
+++ b/gad-admin-options.php
@@ -276,7 +276,7 @@ class GADAdminOptions
}
}
- $ui->display_admin_handle_login_options($gauth);
+ $ui->display_admin_handle_login_options();
}
function admin_handle_clientlogin_login_options(&$ui, $info_message = '')
patch-2.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/gad-admin-options-ui.php b/gad-admin-options-ui.php
index 4ceae90..ba8c7ee 100644
--- a/gad-admin-options-ui.php
+++ b/gad-admin-options-ui.php
@@ -191,7 +191,7 @@ class GADAdminOptionsUI
<?php
}
- function display_admin_handle_login_options($gauth)
+ function display_admin_handle_login_options()
{
?>
@@ -243,17 +243,6 @@ class GADAdminOptionsUI
<td><input name="ga_pass" type="password" size="15" id="ga_pass" class="regular-text" value="" /></td>
</tr>
- <?php if( isset($gauth) && $gauth->requiresCaptcha() ) : ?>
- <tr valign="top">
- <th scope="row"><label for="ga_captcha">Google CAPTCHA</label></th>
- <td>
- <img src="<?php echo $gauth->getCaptchaImageURL(); ?>"/><br/><br/>
- <input name="ga_captcha" type="text" size="10" id="ga_captcha" class="regular-text" value="" />
- <input type="hidden" name="ga_captcha_token" value="<?php echo $gauth->getCaptchaToken(); ?>"/>
- </td>
- </tr>
- <?php endif; ?>
-
<tr valign="top">
<th scope="row"><label for="ga_save_pass">Save Password</label></th>
<td><input name="ga_save_pass" type="checkbox" id="ga_save_pass" value="ga_save_pass" <?php if(isset($_POST['ga_save_pass']) || get_option('gad_login_pass') !== false) echo 'checked'; ?> /></td>
diff --git a/gad-admin-options.php b/gad-admin-options.php
index e6afefb..6f98a5c 100644
--- a/gad-admin-options.php
+++ b/gad-admin-options.php
@@ -276,7 +276,7 @@ class GADAdminOptions
}
}
- $ui->display_admin_handle_login_options($gauth);
+ $ui->display_admin_handle_login_options();
}
function admin_handle_clientlogin_login_options(&$ui, $info_message = '')

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.