diff -ru google_analytics-6.x-3.6-unpatched/googleanalytics.admin.inc google_analytics-6.x-3.6/googleanalytics.admin.inc --- google_analytics-6.x-3.6-unpatched/googleanalytics.admin.inc 2013-04-12 10:11:00.000000000 +0200 +++ google_analytics-6.x-3.6/googleanalytics.admin.inc 2016-08-02 22:08:12.420322506 +0200 @@ -267,6 +267,8 @@ ); // Advanced feature configurations. + $user_access_add_js_snippets = user_access('add JS snippets for google analytics') ? FALSE : TRUE; + $user_access_add_js_snippets_permission_warning = $user_access_add_js_snippets ? ' ' . t('This field has been disabled because you do not have sufficient permissions to edit it.') . '' : ''; $form['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced settings'), @@ -332,17 +334,19 @@ '#type' => 'textarea', '#title' => t('Code snippet (before)'), '#default_value' => variable_get('googleanalytics_codesnippet_before', ''), + '#disabled' => $user_access_add_js_snippets, '#rows' => 5, '#wysiwyg' => FALSE, - '#description' => t("Code in this textarea will be added before _gaq.push(['_trackPageview'])."), + '#description' => t("Code in this textarea will be added before _gaq.push(['_trackPageview']).") . $user_access_add_js_snippets_permission_warning, ); $form['advanced']['codesnippet']['googleanalytics_codesnippet_after'] = array( '#type' => 'textarea', '#title' => t('Code snippet (after)'), '#default_value' => variable_get('googleanalytics_codesnippet_after', ''), + '#disabled' => $user_access_add_js_snippets, '#rows' => 5, '#wysiwyg' => FALSE, - '#description' => t("Code in this textarea will be added after _gaq.push(['_trackPageview']). This is useful if you'd like to track a site in two accounts."), + '#description' => t("Code in this textarea will be added after _gaq.push(['_trackPageview']). This is useful if you'd like to track a site in two accounts.") . $user_access_add_js_snippets_permission_warning, ); /* hook_footer() is not able to add code to head. Upgrade to D7 required. diff -ru google_analytics-6.x-3.6-unpatched/googleanalytics.module google_analytics-6.x-3.6/googleanalytics.module --- google_analytics-6.x-3.6-unpatched/googleanalytics.module 2013-04-12 10:11:00.000000000 +0200 +++ google_analytics-6.x-3.6/googleanalytics.module 2016-08-02 21:55:03.980123194 +0200 @@ -39,7 +39,7 @@ * Implementation of hook_perm(). */ function googleanalytics_perm() { - return array('administer google analytics', 'opt-in or out of tracking', 'use PHP for tracking visibility'); + return array('administer google analytics', 'opt-in or out of tracking', 'use PHP for tracking visibility', 'add JS snippets for google analytics'); } /**