Nuffnang

HOWTO ADD USER MANUALLY IN JOOMLA

Sometime, we need to overide the existing procedure to add user in joomla. So, I'm attach my code below howto add user. You may used my code to create your own component.



class manual {
 function insert() {
  $db=$this->db;
  # STEP 1 - Insert to "Jos Users" table 
  $query="INSERT INTO `jos_users` 
    (`name`, `username`, `email`, `password`, `usertype`, `block`,
    `sendEmail`, `gid`, `registerDate`, `lastvisitDate`, 
    `activation`, `params`) 
    VALUES ('$this->nama', '$this->phone', 'no_email@email.com',
    md5('$this->password'),'Registered', 0, 0, 18, NOW(), 
    '0000-00-00 00:00:00', '', '')";
  $db->setQuery($query);
  $db->query($query);
  $jID=$db->insertid(); 
  # STEP 2 - INSERT TO "Jos Core ACL Aro" with value from 
  #auto increment from insertion to "Jos Users"
  $query="INSERT INTO `jos_core_acl_aro` 
     (`id`, `section_value`, `value`, `order_value`, `name`, `hidden`)
     VALUES ('','users', '$jID', 0, '$this->nama', 0)";
  $db->setQuery($query);
  $db->query($query);
  $AROjID=$db->insertid();
  #STEP 3 INSERT to Jos Core ACL Groups Aro Map with value from 
  #auto increment from insertion to "Jos Core ACL Aro"
  #18 is "REGISTERED" user; 19 is "EDITOR" and 20 is "PUBLISHER"
  $query="INSERT INTO `jos_core_acl_groups_aro_map` 
    (`group_id`, `section_value`, `aro_id`) VALUES (18, '', '$AROjID')";
  $db->setQuery($query);
  $db->query($query); 
 }
 function __construct($db) {
  $this->db=$db;
 }
}

Tiada ulasan:

Catat Ulasan

Please comment, if you think it will help us all.

Like Facebook