## Description: Totally useless feature
## Will show you a random topic.
##
## Installation Level: Easy
## Installation Time: 5-8 Minutes
## Files To Edit: viewtopic.php, index.php,
## language/lang_english/lang_main.php,
## templates/subSilver/index_body.tpl
########################################################
## KNOWN LIMITATIONS:
## Will output an error if you don't have permission
## to view or read the topic.
## Refreshing will get you another topic
########################################################
#
#-----[ FIND in viewtopic.php ]------------------------------------------
#
if( !isset($topic_id) && !isset($post_id) )
#
#-----[ CHANGE to ]------------------------------------------
#
if( !isset($topic_id) && !isset($post_id) && $HTTP_GET_VARS['view'] != 'random' )
#
#-----[ FIND in viewtopic.php ]------------------------------------------
#
else
{
$topic_id = $row['topic_id'];
}
}
#
#-----[ ADD after ]------------------------------------------
#
else if ( $HTTP_GET_VARS['view'] == 'random' )
{
$sql = "SELECT t.topic_id
FROM " . TOPICS_TABLE . " t
ORDER BY RAND()
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain random topic information", '', __LINE__, __FILE__, $sql);
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
else
{
$topic_id = $row['topic_id'];
}
}
#
#-----[ FIND in index.php ]------------------------------------------
#
'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
#
#-----[ ADD after ]------------------------------------------
#
'L_VIEW_RANDOM_TOPIC' => $lang['View_random_topic'],
'U_VIEW_RANDOM_TOPIC' => append_sid("viewtopic.$phpEx?view=random"),
#
#-----[ FIND in language/lang_english/lang_main.php ]-----------------------
#
$lang['Forums_marked_read'] = "All forums have been marked read";
#
#-----[ ADD after ]------------------------------------------
#
$lang['View_random_topic'] = "View A Random Topic";
#
#-----[ FIND in templates/subSilver/index_body.tpl ]------------------------------------------
#
{L_SEARCH_UNANSWERED}
#
#-----[ CHANGE to ]------------------------------------------
#
{L_SEARCH_UNANSWERED}
{L_VIEW_RANDOM_TOPIC
#
#-----------------------------------------------
#
?>