summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhass2010-10-01 23:43:11 (GMT)
committer hass2010-10-01 23:43:11 (GMT)
commitc018bd81ba0697475fc96e35d5ebf22df3c8e49c (patch)
treeb335fad83ed7d93ae516906fb7f0437965e7a8b6
parentd58b33d44fcc2ac73afe216ac3a7139cc2d6787a (diff)
#848350 by hass: Disabling user tracker in user/edit doesn't work
-rw-r--r--googleanalytics.module15
1 files changed, 12 insertions, 3 deletions
diff --git a/googleanalytics.module b/googleanalytics.module
index 25ff1bb..098b4da 100644
--- a/googleanalytics.module
+++ b/googleanalytics.module
@@ -235,7 +235,7 @@ function googleanalytics_form_user_profile_form_alter(&$form, &$form_state) {
'#type' => 'checkbox',
'#title' => t('Enable user tracking'),
'#description' => $description,
- '#default_value' => isset($account->googleanalytics['custom']) ? $account->googleanalytics['custom'] : ($custom == 1)
+ '#default_value' => isset($account->data['googleanalytics']['custom']) ? $account->data['googleanalytics']['custom'] : ($custom == 1)
);
return $form;
@@ -243,6 +243,15 @@ function googleanalytics_form_user_profile_form_alter(&$form, &$form_state) {
}
/**
+ * Implements hook_user_presave().
+ */
+function googleanalytics_user_presave(&$edit, $account, $category) {
+ if (isset($edit['googleanalytics']['custom'])) {
+ $edit['data']['googleanalytics']['custom'] = $edit['googleanalytics']['custom'];
+ }
+}
+
+/**
* Implementation of hook_cron().
*/
function googleanalytics_cron() {
@@ -333,8 +342,8 @@ function _googleanalytics_visibility_user($account) {
// Use the user's block visibility setting, if necessary.
if (($custom = variable_get('googleanalytics_custom', 0)) != 0) {
- if ($account->uid && isset($account->googleanalytics['custom'])) {
- $enabled = $account->googleanalytics['custom'];
+ if ($account->uid && isset($account->data['googleanalytics']['custom'])) {
+ $enabled = $account->data['googleanalytics']['custom'];
}
else {
$enabled = ($custom == 1);