finish Drupal 4.7 upgrade

deekayen - January 5, 2006 - 23:08
Project:Statistics filtering
Version:HEAD
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

The Filter Roles checkboxes are not saving properly, but if that can be fixed, I think it's ready for release.

#1

markus_petrux - January 14, 2006 - 18:01

Just installed the module from CVS and worked for me on a fresh Drupal copy installed from CVS as well. ;-)

#2

markus_petrux - January 14, 2006 - 18:22

Too fast, I've been... now I'm getting "Illegal choice in Roles to ignore." when not setting any role. hmm....

#3

markus_petrux - January 15, 2006 - 18:51

I believe I've been able to make it work using the following code:

  $roles = user_roles();
  $variable_roles = variable_get('statistics_filter_roles', array());
  $default_roles = array();
  foreach ($roles as $key => $value) {
    if (in_array($key, $variable_roles)) {
      $default_roles[] = $key;
    }
  }
  $form['statistics_filter_roles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Roles to ignore'),
    '#default_value' => $default_roles,
    '#options' => $roles,
    '#description' => t("Ignore accesses by users in any of the checked roles.")
  );

Do you prefer a patch? Though, it could probably be made simpler. The trick is #default values do not use a named array. See what I mean?

#4

markus_petrux - January 15, 2006 - 18:55
Status:active» patch (code needs review)

#5

deekayen - January 15, 2006 - 19:17
Status:patch (code needs review)» closed

worked for me after I updated my copy of Drupal core. committed and branched for DRUPAL-4-7

 
 

Drupal is a registered trademark of Dries Buytaert.