/** * @static * @todo document this */ function deleteOneMember($memberid) { global $manager; $memberid = intval($memberid); $mem = MEMBER::createFromID($memberid); if (!$mem->canBeDeleted()) { return _ERROR_DELETEMEMBER; } $manager->notify('PreDeleteMember', array('member' => &$mem)); /* unlink comments from memberid */ if ($memberid) { $query = 'UPDATE ' . sql_table('comment') . ' SET cmember="0", cuser="******" WHERE cmember=' . $memberid; sql_query($query); } $query = 'DELETE FROM ' . sql_table('member') . ' WHERE mnumber=' . $memberid; sql_query($query); $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tmember=' . $memberid; sql_query($query); $query = 'DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . $memberid; sql_query($query); // delete all associated plugin options NucleusPlugin::_deleteOptionValues('member', $memberid); $manager->notify('PostDeleteMember', array('member' => &$mem)); return ''; }
function addTeamMember($memberid, $admin) { global $manager; $memberid = intval($memberid); $admin = intval($admin); // check if member is already a member $tmem = MEMBER::createFromID($memberid); if ($tmem->isTeamMember($this->getID())) { return 0; } $manager->notify('PreAddTeamMember', array('blog' => &$this, 'member' => &$tmem, 'admin' => &$admin)); // add to team $query = 'INSERT INTO ' . sql_table('team') . ' (TMEMBER, TBLOG, TADMIN) ' . 'VALUES (' . $memberid . ', ' . $this->getID() . ', "' . $admin . '")'; sql_query($query); $manager->notify('PostAddTeamMember', array('blog' => &$this, 'member' => &$tmem, 'admin' => $admin)); $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName()); ACTIONLOG::add(INFO, $logMsg); return 1; }
/** * Returns a MEMBER object */ function &getMember($memberid) { $mem =& $this->members[$memberid]; if (!$mem) { // load class if needed $this->_loadClass('MEMBER', 'MEMBER.php'); // create MEMBER object $mem =& MEMBER::createFromID($memberid); $this->members[$memberid] =& $mem; } return $mem; }