method get documentation in bbn\User\Preferences

Returns the current user's preference based on the given id, his own profile and his group.

function(string $id, bool $with_config = true) { if (bbn\Str::isUid($id)) { $table = $this->db->tsn($this->class_cfg['table'], true); $uid = $this->db->csn($this->fields['id'], true); $id_user = $this->db->csn($this->fields['id_user'], true); $id_group = $this->db->csn($this->fields['id_group'], true); $public = $this->db->csn($this->fields['public'], true); if ( $row = $this->db->rselect( [ 'table' => $table, 'fields' => $this->fields, 'where' => [ 'conditions' => [[ 'field' => $uid, 'value' => $id ], [ 'logic' => 'OR', 'conditions' => [[ 'field' => $id_user, 'value' => $this->id_user ], [ 'field' => $id_group, 'value' => $this->id_group ], [ 'field' => $public, 'value' => 1 ]] ]] ] ] ) ) { if ($with_config) { if (empty($row['cfg']) && !empty($row['id_alias'])) { //if it's the case of a shared list takes the $cfg and the text from the alias $alias = $this->db->rselect( [ 'table' => $table, 'fields' => ['cfg', 'text'], 'where' => [ 'conditions' => [[ 'field' => 'id', 'value' => $row['id_alias'] ]] ] ] ); $row['cfg'] = $alias['cfg']; $row['text'] = $alias['text']; } $cfg = $row[$this->fields['cfg']]; unset($row[$this->fields['cfg']]); if ($cfg = json_decode($cfg, true)) { $row = bbn\X::mergeArrays($cfg, $row); } } return $row; } } return null; }

Returns the current user's preference based on the given id, his own profile and his group. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.