Index: click_heatmap.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/click_heatmap/click_heatmap.module,v retrieving revision 1.5.4.15 diff -u -r1.5.4.15 click_heatmap.module --- click_heatmap.module 28 Sep 2009 07:09:58 -0000 1.5.4.15 +++ click_heatmap.module 28 Sep 2009 07:32:13 -0000 @@ -41,7 +41,7 @@ * Implementation of hook_perm(). */ function click_heatmap_perm() { - return array('administer heatmaps', 'view heatmaps'); + return array('administer heatmaps', 'view heatmaps', 'count click_heatmap clicks'); } /** @@ -83,15 +83,17 @@ * Check to see if the click heatmap javascript should be added to the page. */ function click_heatmap_display() { - switch (variable_get('click_heatmap_scope', 'home')) { - case 'all': - return TRUE; - case 'user': - return (strpos(substr(click_heatmap_get_url(), 0, 5), 'admin') === FALSE); - case 'admin': - return (strpos(substr(click_heatmap_get_url(), 0, 5), 'admin') !== FALSE); - case 'home': - return (click_heatmap_get_url() == 'home'); + if (user_access('count click_heatmap clicks')) { + switch (variable_get('click_heatmap_scope', 'home')) { + case 'all': + return TRUE; + case 'user': + return (strpos(substr(click_heatmap_get_url(), 0, 5), 'admin') === FALSE); + case 'admin': + return (strpos(substr(click_heatmap_get_url(), 0, 5), 'admin') !== FALSE); + case 'home': + return (click_heatmap_get_url() == 'home'); + } } return FALSE; } Index: click_heatmap.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/click_heatmap/Attic/click_heatmap.install,v retrieving revision 1.1.8.6 diff -u -r1.1.8.6 click_heatmap.install --- click_heatmap.install 28 Sep 2009 05:27:36 -0000 1.1.8.6 +++ click_heatmap.install 28 Sep 2009 07:32:13 -0000 @@ -84,3 +84,44 @@ return $ret; } + +/** + * Add 'count click_heatmap clicks' to anonymous role. + */ +function click_heatmap_update_6201(&$sandbox = NULL) { + $ret = array(); + + module_load_include('admin.inc', 'user'); + + // Load current anonymous role permissions. + $result = db_query('SELECT r.rid, p.perm + FROM {role} r + LEFT JOIN {permission} p + ON r.rid = p.rid + WHERE r.rid = %d', DRUPAL_ANONYMOUS_RID); + $role = db_fetch_object($result); + + // Ensure that 'count click_heatmap clicks' is among the permissions. + $permissions = explode(', ', $role->perm); + $permissions[] = 'count click_heatmap clicks'; + $permissions = array_unique($permissions); + + + // Generate a form state. + $form_state = array( + 'values' => array( + DRUPAL_ANONYMOUS_RID => array(), + 'op' => t('Save permissions'), + ), + ); + + // Format permissions as checkboxes. + foreach ($permissions as $permission) { + $form_state['values'][DRUPAL_ANONYMOUS_RID][$permission] = TRUE; + } + + // Save the permissions. + drupal_execute('user_admin_perm', $form_state); + + return $ret; +} Index: INSTALL.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/click_heatmap/Attic/INSTALL.txt,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 INSTALL.txt --- INSTALL.txt 28 Sep 2009 04:23:31 -0000 1.1.2.1 +++ INSTALL.txt 28 Sep 2009 07:32:13 -0000 @@ -18,3 +18,7 @@ - click_heatmap/heatmaps/ 4. Enable the module and configure at: admin/settings/click_heatmap. + +5. Grant the 'count click_heatmap clicks' permission to the roles you wish to + be counted in the heatmaps. In general you will want to grant the permission + to anonymous users.