$announcement_topics = array(); //$announcement_forums = array_unique(array_keys($auth->acl_getf('f_read', true))); $announcement_forums = array(2); $announcement_topics = 'SELECT * FROM ' . TOPICS_TABLE . ' LEFT OUTER JOIN ' . POSTS_TABLE . ' ON ' . TOPICS_TABLE . '.topic_first_post_id = ' . POSTS_TABLE . '.post_id ' . $forum_id_where . ' WHERE ' . TOPICS_TABLE . '.topic_approved = 1 AND ' . $db->sql_in_set(POSTS_TABLE . ".forum_id", $announcement_forums) . ' AND ' . POSTS_TABLE . '.post_text IS NOT NULL ORDER BY ' . TOPICS_TABLE . '.topic_last_post_time DESC'; $announcements_topics_result = $db->sql_query_limit($announcement_topics, TOPICS_LIMIT); while ($topics_row = $db->sql_fetchrow($announcements_topics_result)) { $topic_title = $topics_row['topic_title']; $topic_author = get_username_string('full', $topics_row['topic_poster'], $topics_row['topic_first_poster_name'], $topics_row['topic_first_poster_colour']); $topic_date = $user->format_date($topics_row['topic_time']); $topic_last_post = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topics_row['forum_id'] . '&t=' . $topics_row['topic_id'] . '&p=' . $topics_row['topic_last_post_id']) . '#p' . $topics_row['topic_last_post_id']; $topic_last_author = get_username_string('full', $topics_row['topic_last_poster_id'], $topics_row['topic_last_poster_name'], $topics_row['topic_last_poster_colour']); $topic_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topics_row['forum_id'] . '&t=' . $topics_row['topic_id']); $post_text = $posts_row['post_text']; $post_text = smiley_text($post_text); $template->assign_block_vars('announcements', array( 'TOPIC_TITLE' => censor_text($topic_title), 'TOPIC_AUTHOR' => $topic_author, 'TOPIC_DATE' => $topic_date, 'TOPIC_LAST_POST' => $topic_last_post, 'TOPIC_LAST_AUTHOR' => $topic_last_author, 'TOPIC_LINK' => $topic_link, 'TOPIC_TEXT' => censor_text($post_text), )); }