/** * Template function: display author of comment * * @param string String to display before author name if not a user * @param string String to display after author name if not a user * @param string String to display before author name if he's a user * @param string String to display after author name if he's a user * @param string Output format, see {@link format_to_output()} * @param boolean true for link, false if you want NO html link */ function author($before = '', $after = '#', $before_user = '', $after_user = '******', $format = 'htmlbody', $makelink = false) { global $Plugins; if ($this->get_author_User()) { // Author is a user if (strlen($this->author_User->url) <= 10) { $makelink = false; } if ($after_user == '#') { $after_user = '******' . T_('Member') . ']'; } $author_name = format_to_output($this->author_User->get_preferred_name(), $format); $before = $before_user; $after = $after_user; } else { // Display info recorded at edit time: if (strlen($this->author_url) <= 10) { $makelink = false; } if ($after == '#') { $after = ' [' . T_('Visitor') . ']'; } $author_name = $this->dget('author', $format); } if ($makelink) { // Make a link: $r = $this->get_author_url_link($author_name, $before, $after, true); } else { // Display the name: (NOTE: get_author_url_link( with nolink option ) would NOT handle this correctly when url is empty $r = $before . $author_name . $after; } $Plugins->trigger_event('FilterCommentAuthor', array('data' => &$r, 'makelink' => $makelink, 'Comment' => $this)); echo $r; }
/** * Get the comment author's name. * * @return string */ function get_author_name() { if ($this->get_author_User()) { return $this->author_User->get_preferred_name(); } else { return $this->author; } }