Hi!
I have been using
this mod on phpBB. I want to copy the 'view unanswered posts' search function then edit it to view all topics, but I am a little lost.
This is what I have.
Code:
#
#-----[ OPEN ]------------------------------------------
#
includes/class_search.php
#
#-----[ FIND ]------------------------------------------
#
class topics_search_unanswered extends topics_search
{
function read()
{
global $db, $user;
$this->forum_id = 0;
$this->total_topics = 0;
$this->data_ext = array();
// get topics without replies
$sql = 'SELECT t.*
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_replies = 0
AND t.forum_id IN(' . implode(', ', $this->authed_forums()) . ')
AND t.topic_moved_id = 0
ORDER BY t.topic_last_post_id DESC';
$result = $db->sql_query($sql, false, __LINE__, __FILE__);
// read results
if ( ($this->total_topics = $db->sql_numrows($result)) && ($this->total_topics > intval($this->parms['start'])) )
{
$db->sql_rowseek(intval($this->parms['start']), $result);
$this->do_read($result, intval($this->parms['ppage']));
}
$db->sql_freeresult($result);
$this->total_items = $this->total_topics;
}
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
class topics_search_all_posts extends topics_search
{
function read()
{
global $db, $user;
$this->forum_id = 0;
$this->total_topics = 0;
$this->data_ext = array();
// get topics without replies
$sql = 'SELECT t.*
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id IN(' . implode(', ', $this->authed_forums()) . ')
AND t.topic_moved_id = 0
ORDER BY t.topic_last_post_id DESC';
$result = $db->sql_query($sql, false, __LINE__, __FILE__);
// read results
if ( ($this->total_topics = $db->sql_numrows($result)) && ($this->total_topics > intval($this->parms['start'])) )
{
$db->sql_rowseek(intval($this->parms['start']), $result);
$this->do_read($result, intval($this->parms['ppage']));
}
$db->sql_freeresult($result);
$this->total_items = $this->total_topics;
}
}
#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
case 'unanswered':
$user->read_cookies();
$search->display_topics();
break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
case 'all_posts':
$user->read_cookies();
$search->display_topics();
break;
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
'S_ACTION' => $config->url($requester, array(POST_FORUM_URL => $forum_id), true),
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_SEARCH_ALL_POSTS' => $lang['Search_all_posts'],
'U_SEARCH_ALL_POSTS' => append_sid("includes/class_search.$phpEx?search_id=all_posts&search_forum=$forum_id"),
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
#
$lang['Search_unanswered'] = 'View unanswered posts';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Search_all_posts'] = 'View all topics'
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/topics_box.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN mark --><a href="{forum_header.U_MARK_READ}" class="gensmall">{forum_header.L_MARK_READ}</a><br /><!-- END mark -->
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{L_MARK_TOPICS_READ}</a>
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
- <a href="{U_SEARCH_ALL_POSTS}">{L_SEARCH_ALL_POSTS}</a>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Any help would be appreciated. I asked this question over at the CH mod forum website, but I didn't get a satisfactory answer. The designer of the mod doesn't speak English very well, and he speaks tech-speak much more fluently than I do, so there was a lot lost in translation.