/** * Check if user is an author. * @param GWF_User $user * @return boolean */ public function isAuthor(GWF_User $user) { # Field is empty so everyone can add. if ('' === ($authors = trim($this->cfgAuthors()))) { return true; } # Check author level if ($this->cfgAuthorLevel() > $user->getLevel()) { return false; # Nope } # Check author groupnames foreach (preg_split('/[,;]+/', $authors) as $groupname) { if ($user->isInGroupName($groupname)) { return true; } } # Nope return false; }