Groups file are not updated if user added with admin/user/user/create
During edit with user/%uid/edit or cron.php run groups file is updated.

Comments

karchie1’s picture

having the same problem

m.fu’s picture

Assigned: Unassigned » m.fu
Status: Active » Needs work

Looking into it.

m.fu’s picture

Status: Needs work » Fixed

used a workaround, now update group file when the user information is user load hook which is executed after saving the data.
The after_update in not called at the right time and the user add hook is executed before the groups/roles are updated.

fasdalf@fasdalf.ru’s picture

Status: Fixed » Postponed

Thanks a lot for your work!

I would say, user_load is called very often. For user profile at least and even for comment's author display in some themes, approximately once for every user, mentioned on the page. Each time hook_user() is called with $op=load
So i suggest to use somethinng like that

function htpasswdsync_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case "delete": 
      _htpasswdsync_delete($edit);
    break;
    case "insert": 
      _htpasswdsync_update($edit, $account);
    break;
    case "update": 
      _htpasswdsync_update($edit, $account);
    break;
    case "after_update": 
      _htpasswdsync_commit_to_htpasswd();
      variable_set('htpasswdsync_updategroups_now',1);
    break;
    case "validate": 
      _htpasswdsync_validate($edit, $account);
    break;
    case "load":
      if (variabel_get('htpasswdsync_updategouops_now',0)) {
        _htpasswdsync_updategroup();
        variable_set('htpasswdsync_updategroups_now',0);
      }
    break;
  }
} // function htpasswdsync_user()

IMHO this version works faster, because variables are loaded in one query during drupal bootstrap.

m.fu’s picture

Status: Postponed » Fixed

Fixed in 6.x-1.6-rc1

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.