After user/%/delete submit i see this:
warning: Invalid argument supplied for foreach() in /hsphere/local/home/leader-fasdalf/anapax.ru/sites/all/modules/htpasswdsync/HTPasswdSync.module on line ***

That's foreach ($account['accounts'] as $a) { piece of _htpasswdsync_delete($account) function

And user stay stored in your table.

When delete called from user/%/delete pages UID stored in $account['_account']->uid

Comments

fasdalf@fasdalf.ru’s picture

Status: Needs work » Active
StatusFileSize
new3.51 KB
new24.86 KB
new23.93 KB

Drupal calls hook_user for every deleted user, so bulk user deletion is almost useless. This funtions was changed.

function _htpasswdsync_updatepasswd() {
  $file = _htpasswdsync_passfilename();
  $passwords = array();

  //get all users  
  $res = db_query('SELECT username, passwd FROM {htpasswdsync_passwd}');
  while ($r = db_fetch_object($res)) {

    $passwords[$r->username] = $r->passwd; 
  }
  _htpasswdsync_write_htfile($passwords, $file);
 }

Passfile load removed.
DELETED rows check removed because deleted uders do not stay in database anymore.

function _htpasswdsync_delete($account) {
  $f = _htpasswdsync_passfilename();
  $passwds = array();
  _htpasswdsync_read_htfile($passwds, $f);
    // single user deletion
    unset($passwds[$account['name']]);
    db_query("DELETE FROM {htpasswdsync_passwd} WHERE username = '%s'", $account->name);
  _htpasswdsync_write_htfile($passwds, $f);

  _htpasswdsync_updategroup();
 }// function _htpasswdsync_delete


Don't create DELETED rows in database
Use one user account details (user object)

function htpasswdsync_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case "delete": 
      _htpasswdsync_delete($account);
    break;
    case "insert": 
      _htpasswdsync_update($edit);
    break;
    case "update": 
      _htpasswdsync_update($edit);
    break;
  }
} // function htpasswdsync_user()


Give _htpasswdsync_delete user $account object instead of $edit form

There is a HTPasswdSync-437844-1.patch for this issue specialy and full patch for full complex isue fix, including #437904: Invalid group file generated on user creation/edit
Modified module also included.

fasdalf@fasdalf.ru’s picture

Status: Active » Needs work

Needs to be tested and included in next release.

fasdalf@fasdalf.ru’s picture

Status: Active » Needs work
StatusFileSize
new3.57 KB

Uploading fixed module. Syntax error with $account->name fixed now.

m.fu’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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