GanstaZ wrote: ↑Sun Oct 14, 2018 10:30 pm Something like this.. or use the method provided by 3Di)Code: Select all
$user_loader = new \phpbb\user_loader($this->db, $this->phpbb_root_path, $this->phpEx, USERS_TABLE); $sql = 'SELECT forum_id, topic_id, topic_title, topic_time, topic_views, topic_poster, topic_posts_approved, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_view_time, topic_last_poster_id FROM ' . TOPICS_TABLE . ' WHERE ' . $this->db->sql_in_set('forum_id', $flast) . ' AND ' . $this->content_visibility->get_visibility_sql('topic', 'topic') . ' ORDER BY topic_last_post_time DESC'; $result = $this->db->sql_query_limit($sql, $this->config['last_total']); $array = []; $user_loader->load_users($array); while ($row = $this->db->sql_fetchrow($result)) { $array[] = $row['topic_last_poster_id']; $this->template->assign_block_vars('last_topic', array( 'LAST_LINK' => append_sid("{$this->phpbb_root_path}viewtopic.$this->phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), 'U_LAST_TOPIC' => append_sid("{$this->phpbb_root_path}viewtopic.$this->phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']), 'LAST_POSTER' => append_sid("{$this->phpbb_root_path}memberlist.$this->phpEx", 'mode=viewprofile' . '&u=' . $row['topic_poster']), 'USERNAME_LAST' => append_sid("{$this->phpbb_root_path}memberlist.$this->phpEx", 'mode=viewprofile' . '&u=' . $row['topic_last_poster_id']), 'TOPIC_TITLE' => $row['topic_title'], 'TOPIC_VIEWS' => $row['topic_views'], 'TOPIC_REPLIES' => $row['topic_posts_approved'], 'TOPIC_LAST_POSTER_NAME' => $row['topic_last_poster_name'], 'TOPIC_LAST_POSTER_COLOUR' => $row['topic_last_poster_colour'], 'TOPIC_LAST_POST_TIME' => $this->user->format_date($row['topic_last_post_time']), 'TOPIC_LAST_VIEW_TIME' => $this->user->format_date($row['topic_last_view_time']), 'USERNAME_AV' => $user_loader->get_avatar($row['topic_last_poster_id']), )); } $this->db->sql_freeresult($result); unset($user_loader);
This actually did work! Thank you!