src/bbn/user.php
private function _user_info(){
    if ( $this->get_id() ){
      if ( !empty($this->get_session('cfg')) ){
        $this->cfg = $this->get_session('cfg');
        $this->id_group = $this->get_session('id_group');
      }
      else if ( $d = $this->db->rselect(
        $this->class_cfg['tables']['users'],
        array_unique(array_values($this->fields)),
        x::merge_arrays(
          $this->class_cfg['conditions'],
          [$this->fields['active'] => 1],
          [$this->fields['id'] => $this->id]))
      ){
        $r = [];
        foreach ( $d as $key => $val ){
          $this->$key = $val;
          $r[$key] = $key === $this->fields['cfg'] ? json_decode($val, true) : $val;
        }
        $this->cfg = $r['cfg'] ?: [];
        // Group
        $this->id_group = $r['id_group'];
        $this->session->set($r, self::$un);
        $this->save_session();
      }
    }
    return $this;
  }
private function _user_info(){
    if ( $this->get_id() ){
      if ( !empty($this->get_session('cfg')) ){
        $this->cfg = $this->get_session('cfg');
        $this->id_group = $this->get_session('id_group');
      }
      else if ( $d = $this->db->rselect(
        $this->class_cfg['tables']['users'],
        array_unique(array_values($this->fields)),
        x::merge_arrays(
          $this->class_cfg['conditions'],
          [$this->fields['active'] => 1],
          [$this->fields['id'] => $this->id]))
      ){
        $r = [];
        foreach ( $d as $key => $val ){
          $this->$key = $val;
          $r[$key] = $key === $this->fields['cfg'] ? json_decode($val, true) : $val;
        }
        $this->cfg = $r['cfg'] ?: [];
        // Group
        $this->id_group = $r['id_group'];
        $this->session->set($r, self::$un);
        $this->save_session();
      }
    }
    return $this;
  }
private function _user_info ( ) { if ( $ this -> get_id ( ) ) { if ( ! empty ( $ this -> get_session ( 'cfg' ) ) ) { $ this -> cfg = $ this -> get_session ( 'cfg' ) ; $ this -> id_group = $ this -> get_session ( 'id_group' ) ; } else if ( $ d = $ this -> db -> rselect ( $ this -> class_cfg [ 'tables' ] [ 'users' ] , array_unique ( array_values ( $ this -> fields ) ) , x :: merge_arrays ( $ this -> class_cfg [ 'conditions' ] , [ $ this -> fields [ 'active' ] => 1 ] , [ $ this -> fields [ 'id' ] => $ this -> id ] ) ) ) { $ r = [ ] ; foreach ( $ d as $ key => $ val ) { $ this -> $ key = $ val ; $ r [ $ key ] = $ key === $ this -> fields [ 'cfg' ] ? json_decode ( $ val , true ) : $ val ; } $ this -> cfg = $ r [ 'cfg' ] ? : [ ] ; // Group $ this -> id_group = $ r [ 'id_group' ] ; $ this -> session -> set ( $ r , self :: $ un ) ; $ this -> save_session ( ) ; } } return $ this ; }
Gathers all the information about a user and puts it in the session
The user's table data can be sent as argument if it has already been fetched

@param array $d The user's table data

@return $this
Gathers all the information about a user and puts it in the session The user s table data can be sent as argument if it has already been fetched