public function add(array $data)
    {
        $result = null;
        $this->hook->attach('user.add.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        if (empty($data['name'])) {
            $data['name'] = strtok($data['email'], '@');
        }

        $data['created'] = $data['modified'] = GC_TIME;
        $data['hash'] = gplcart_string_hash($data['password']);
        $result = $data['user_id'] = $this->db->insert('user', $data);

        $this->setAddress($data);

        $this->hook->attach('user.add.after', $data, $result, $this);
        return (int) $result;
    }
public function add(array $data)
    {
        $result = null;
        $this->hook->attach('user.add.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        if (empty($data['name'])) {
            $data['name'] = strtok($data['email'], '@');
        }

        $data['created'] = $data['modified'] = GC_TIME;
        $data['hash'] = gplcart_string_hash($data['password']);
        $result = $data['user_id'] = $this->db->insert('user', $data);

        $this->setAddress($data);

        $this->hook->attach('user.add.after', $data, $result, $this);
        return (int) $result;
    }
public function add ( array $ data ) { $ result = null ; $ this -> hook -> attach ( 'user.add.before' , $ data , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( int ) $ result ; } if ( empty ( $ data [ 'name' ] ) ) { $ data [ 'name' ] = strtok ( $ data [ 'email' ] , '@' ) ; } $ data [ 'created' ] = $ data [ 'modified' ] = GC_TIME ; $ data [ 'hash' ] = gplcart_string_hash ( $ data [ 'password' ] ) ; $ result = $ data [ 'user_id' ] = $ this -> db -> insert ( 'user' , $ data ) ; $ this -> setAddress ( $ data ) ; $ this -> hook -> attach ( 'user.add.after' , $ data , $ result , $ this ) ; return ( int ) $ result ; }
Adds a user
@param array $data
@return integer
Adds a user