method update documentation in bbn\Entities\People

function($id, $fn) { if ($this->get_info($id)) { $fields = array_keys($this->db->getColumns('bbn_people')); $not_cfg = ['id_lieu', 'roles', 'id_adherent', 'fnom', 'fonctions', 'licence', 'montant', 'parts', 'effet', 'adherents', 'types_liens', 'id_option', 'suggestions', 'relations', 'ffnom', 'id_tier_ext', 'wp_group', 'is_admin']; $wp_group = false; $id_adh = false; $wp = false; foreach ($fn as $k => $v){ if (!in_array($k, $fields) || ($k === 'id')) { if(!in_array($k, $not_cfg) && ($k !== 'id')) { if ($k === 'inscriptions') { if (!empty($v) && \bbn\Str::isEmail($fn['email'])) { $fn['cfg'][$k] = $v; } } else { $fn['cfg'][$k] = (string)$fn[$k]; } } if ($k === 'wp_group') { $wp_group = $v; } if ($k === 'id_adherent') { $id_adh = $v; } unset($fn[$k]); } } $fn['cfg'] = !empty($fn['cfg']) ? json_encode($fn['cfg']) : null; if (!empty($wp_group) && !empty($id_adh)) { $adh = new \apst\adherent($this->db, $id_adh); if ($adh->check()) { $people = $this->db->rselect('bbn_people', ['email', 'fullname'], ['id' => $id]); if (!empty($fn['email']) || !empty($people['email'])) { if ($adh->wps_has_contact($id)) { $wp = $adh->wps_update_contact( [ 'id' => $id, 'group' => $wp_group, 'email' => $fn['email'] ?? $people['email'], 'nom' => $people['fullname'] ] ); } else { $wp = $adh->wps_add_contact( [ 'id' => $id, 'group' => $wp_group, 'email' => $fn['email'] ?? $people['email'], 'nom' => $people['fullname'] ] ); } } $adh->update_full(); } } if (((count($fn) > 0) && $this->db->update('bbn_people', $fn, ['id' => $id])) || !empty($wp) ) { return $id; } } return false; }

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.