Get username
public get_username ( integer $user_id, string $mode, string $guest_username = false, string $custom_profile_url = false, boolean $query = false ) : string | ||
$user_id | integer | User ID of the user you want to retreive the username for |
$mode | string | The mode to load (same as get_username_string). One of the following: profile (for getting an url to the profile) username (for obtaining the username) colour (for obtaining the user colour) full (for obtaining a html string representing a coloured link to the users profile) no_profile (the same as full but forcing no profile link) |
$guest_username | string | Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then. |
$custom_profile_url | string | Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} |
$query | boolean | Should we query the database if this user has not yet been loaded? Typically this should be left as false and you should make sure you load users ahead of time with load_users() |
리턴 | string |
/** * Get email template variables * * @return array */ public function get_email_template_variables() { if ($this->get_data('post_username')) { $username = $this->get_data('post_username'); } else { $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); } return array('AUTHOR_NAME' => htmlspecialchars_decode($username), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}", 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&e=1&view=unread#unread", 'U_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", 'U_FORUM' => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}", 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?uid={$this->user_id}&f={$this->get_data('forum_id')}&t={$this->item_parent_id}&unwatch=topic"); }
/** * Get email template variables * * @return array */ public function get_email_template_variables() { $board_url = generate_board_url(); if ($this->get_data('post_username')) { $username = $this->get_data('post_username'); } else { $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); } return array('AUTHOR_NAME' => htmlspecialchars_decode($username), 'FORUM_NAME' => htmlspecialchars_decode($this->get_data('forum_name')), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), 'U_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->item_parent_id}&t={$this->item_id}", 'U_VIEW_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->item_parent_id}&t={$this->item_id}", 'U_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?f={$this->item_parent_id}", 'U_STOP_WATCHING_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?uid={$this->user_id}&f={$this->item_parent_id}&unwatch=forum"); }
/** * Get the HTML formatted title of this notification * * @return string */ public function get_title() { $username = $this->user_loader->get_username($this->get_data('from_user_id'), 'no_profile'); return $this->language->lang('NOTIFICATION_PM', $username); }
/** * {@inheritdoc} */ public function get_title() { $username = $this->user_loader->get_username($this->item_id, 'no_profile'); return $this->language->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name')); }
/** * {@inheritdoc} */ public function get_url() { return $this->user_loader->get_username($this->item_id, 'profile'); }