You are here

function subuser_user in Subuser 5

Same name and namespace in other branches
  1. 6 subuser.module \subuser_user()

File

./subuser.module, line 97

Code

function subuser_user($type, &$edit, &$account, $category = NULL) {
  global $user;

  // Handle Add sub-user
  $refuid = $edit["mainuid"];
  if ($user->uid != 1) {
    $refuid = $user->uid;
  }
  if ($type == 'insert') {

    //db_query("INSERT INTO {subuser} SET uid='".$usr->uid."', refuid='".$refuid."'");
    db_query("INSERT INTO {subuser} SET uid=%d,refuid='%d'", $account->uid, $refuid);
  }

  // Handle Delete
  if ($type == 'delete') {

    //db_query("DELETE FROM {subuser}  WHERE uid='".$usr->uid."' AND refuid='".$refuid."'");
    db_query("DELETE FROM {subuser} SET uid=%d,refuid='%d'", $account->uid, $refuid);
  }
}