Insert user in Support suite using CodeIginiter

Paste following code in end of database.php located in config folder

$db['db_support']['hostname'] = "localhost";
$db['db_support']['username'] = "dbname";
$db['db_support']['password'] = "password";
$db['db_support']['database'] = "supportsuite_databasename";
$db['db_support']['dbdriver'] = "mysql";
$db['db_support']['dbprefix'] = "";
$db['db_support']['pconnect'] = TRUE;
$db['db_support']['db_debug'] = TRUE;
$db['db_support']['cache_on'] = FALSE;
$db['db_support']['cachedir'] = "";
$db['db_support']['char_set'] = "utf8";
$db['db_support']['dbcollat'] = "utf8_general_ci";

and use this one where ever you want.

 
        $this->db->select("users.*", FALSE);  //these are tables where you have original codeigniter based users
        $this->db->select("user_profile.*", FALSE);
        $this->db->join('user_profile', "user_profile.user_id = users.id");
        $this->db->where('users.id',$user_id);
        $this->db->order_by("users.id", "ASC");
        $query = $this->db1->get();
        //print_r( $query->row_array());
 
       $this->db1 = $this->load->database('db_support', TRUE);
        $this->db1->from('swusers');
        $this->db1->where('swusers');
        $query = $this->db1->get();
        //print_r( $query->row_array());
 
        $user=array(
            'userid' =>'',
            'usergroupid' =>3,
            'fullname' =>'',
            'phone' =>'',
            'userpassword' =>'',
            'userpasswordtxt' =>'',
            'dateline' =>'',
            'lastvisit' =>'',
            'lastactivity' =>'',
            'enabled' =>'',
            'loginapi_moduleid' =>'',
            'loginapi_userid' =>'',
            'languageid' =>'',
            'timezoneoffset' =>'',
            'enabledst' =>'',
            'useremailcount' =>'',
            'allowemail' =>'',
            'slaplanid' =>'',
            'slaexpiry' =>'',
            'ismanager' =>''
        );
 
        $this->db1->insert('swusers',$user);
 
        $user_email=array(
            'useremailid'=> '',
            'userid' => $this->db1->insert_id(),
            'email' => 'isprimary'
        );
 
        $this->db1->insert('swusers',$user);
Category(s): CodeIgniter, PHP, PHP-Tips
Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

 

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">