Advertisement:

Navigation

Readme

Rate That Topic

This mod gives the users the ability to rate topics. Here are the features noted in a detailed way:

  • An ultimate admin panel allows you to set every possible setting for the mod
  • A settings to completely disable the feature
  • Ability to disable or set the values and exclude groups for each board
  • Supports both "Default" and "Local" setting for each board
  • Feature to reset the topic ratings
  • Ability to show ratings on message index
  • "Do not show sticky topic ratings" feature
  • Rating log feature feature
  • Rate again and Change rate features


-[SiNaN]

File Edits

./index.php

Find: [Select]
'recent' => array('Recent.php', 'RecentPosts'),
Replace With: [Select]
'rate' => array('Subs-Rate.php', 'Rate'),
'rateadmin' => array('RateAdmin.php', 'RateAdmin'),
'ratelog' => array('RateAdmin.php', 'RateLog'),
'recent' => array('Recent.php', 'RecentPosts'),

./Sources/Display.php

Find: [Select]
// Load up the "double post" sequencing magic.
Replace With: [Select]
if(!empty($modSettings['rate_enabled'])) {

require_once($sourcedir . '/Subs-Rate.php');

if(getRatingStatus($board)) {

$context['show_rate'] = true;
$context['can_rate'] = canRate($board, $topic);
$context['user_rating'] = $context['can_rate'] == 1 ? getUserRating($topic) : 0;
$context['rating_average'] = getRatingAverage($topic);
}
}

// Load up the "double post" sequencing magic.

./Sources/MessageIndex.php

Find: [Select]
$txt, $scripturl, $board, $db_prefix
Replace With: [Select]
$txt, $scripturl, $board, $db_prefix, $sourcedir
Find: [Select]
// Grab the appropriate topic information...
Replace With: [Select]
if(!empty($modSettings['rate_enabled']) && !empty($modSettings['rate_showMessageIndex'])) {

require_once($sourcedir . '/Subs-Rate.php');

if(getRatingStatus($board)) {
$context['show_rate'] = true;
}
}

// Grab the appropriate topic information...

Find: [Select]
'pages' => $pages,
Replace With: [Select]
'pages' => $pages,
'rating_average' => !empty($context['show_rate']) ? getRatingAverage($row['ID_TOPIC']) : '',

./Sources/Subs.php

Find: [Select]
$context['admin_areas']['layout']['areas']['posts_and_topics'] = '<a href="' . $scripturl . '?action=postsettings">' . $txt['manageposts'] . '</a>';
Replace With: [Select]
$context['admin_areas']['layout']['areas']['posts_and_topics'] = '<a href="' . $scripturl . '?action=postsettings">' . $txt['manageposts'] . '</a>';
if (allowedTo(array('admin_forum', 'moderate_forum')))
$context['admin_areas']['layout']['areas']['rate'] = '<a href="' . $scripturl . '?action=rateadmin">' . $txt['rate_adminTitle'] . '</a>';

./Themes/default/Display.template.php

Find: [Select]
<td valign="middle" width="85%" style="padding-left: 6px;" id="top_subject">
', $txt[118], ': ', $context['subject'], ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
Replace With: [Select]
<td valign="middle" width="65%" style="padding-left: 6px;" id="top_subject">
', $txt[118], ': ', $context['subject'], ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
', !empty($context['show_rate']) ? $txt['rate_average'] . ': ' . ($context['can_moderate_forum'] ? '<a href="' . $scripturl . '?action=ratelog;id=' . $context['current_topic'] . '">' : '') . '<img src="' . $settings['default_images_url'] . '/tr' . $context['rating_average'] . '.png" alt="' . $context['rating_average'] . '" />' . ($context['can_moderate_forum'] ? '</a>' : '') : '', '
</td>
<td width="20%">';
if(!empty($context['can_rate']))
echo '
<div class="smalltext" style="float:right;">
<form action="', $scripturl, '?action=rate" method="post" name="topicRating" accept-charset="', $context['character_set'], '">
', $context['can_rate'] == 1 ? $txt['rate_topicAgain'] : $txt['rate_topicNew'], '
<select name="rate">
<option value="">---</option>
<option value="1"', $context['user_rating'] == 1 ? 'selected="selected"' : '', '>1</option>
<option value="2"', $context['user_rating'] == 2 ? 'selected="selected"' : '', '>2</option>
<option value="3"', $context['user_rating'] == 3 ? 'selected="selected"' : '', '>3</option>
<option value="4"', $context['user_rating'] == 4 ? 'selected="selected"' : '', '>4</option>
<option value="5"', $context['user_rating'] == 5 ? 'selected="selected"' : '', '>5</option>
</select>
<input type="submit" name="rateTopic" value="', $txt['rate_topicGo'], '" />
<input type="hidden" name="topic" value="', $context['current_topic'], '" />
<input type="hidden" name="board" value="', $context['current_board'], '" />
</form>
</div>';
echo '

Find: [Select]
<td colspan="3" class="smalltext">';
Replace With: [Select]
<td colspan="4" class="smalltext">';

./Themes/default/MessageIndex.template.php

Find: [Select]
if (!empty($settings['seperate_sticky_lock']))
Replace With: [Select]
if(!empty($context['show_rate']) && !$topic['is_locked'] && !empty($modSettings['rate_showMessageIndex']) && ($modSettings['rate_showMessageIndex'] == 2 || ($modSettings['rate_showMessageIndex'] == 1 && !$topic['is_sticky'])))
echo ($context['can_moderate_forum'] ? '<a href="' . $scripturl . '?action=ratelog;id=' . $topic['id'] . '">' : '') . '<img src="' . $settings['default_images_url'] . '/tr' . $topic['rating_average'] . '.png" align="right" alt="' . $topic['rating_average'] . '" />' . ($context['can_moderate_forum'] ? '</a>' : '');

if (!empty($settings['seperate_sticky_lock']))

./Themes/default/languages/Modifications.english.php

Find (at the end of the file): [Select]
?>
Add Before: [Select]

// Topic Rating Mod
$txt['rate_adminTitle'] = 'Topic Rating Admin';
$txt['rate_adminHelp'] = 'This panel gives you possibilty to change the Topic Rating settings.';
$txt['rate_adminDesc'] = 'Topic Rating control panel.';
$txt['rate_defaultTitle'] = 'Default Settings';
$txt['rate_defaultDesc'] = 'Panel which allows you to change default settings for the mod.';
$txt['rate_boardsTitle'] = 'Board Settings';
$txt['rate_boardsDesc'] = 'Panel which allows you to change board specific settings for the mod.';

$txt['rate_enabled'] = 'Enable Topic Rating?';
$txt['rate_againType'] = 'Rate again type:';
$txt['rate_againTypeOp'] = 'Disable|Change Rating|Rate Again';
$txt['rate_againWait'] = 'Rate again wait time:';
$txt['rate_showMessageIndex'] = 'Topic Ratings on Message Index?';
$txt['rate_showMessageIndexOp'] = 'Disable|Exclude Sticky|Enable';
$txt['rate_excludedGroups'] = 'Excluded Groups:';

$txt['rate_reset'] = 'Reset Topic Ratings';
$txt['rate_resetConfirm'] = 'Are you sure to reset topic ratings?';
$txt['rate_resetSuccess'] = 'All topic ratings are reset.';
$txt['rate_resetFail'] = 'An Error Occured: Topic Rating could not be reset.';

$txt['rate_boardsName'] = 'Name';
$txt['rate_boardsModify'] = 'Modify';
$txt['rate_typeDefault'] = 'Default';
$txt['rate_typeLocal'] = 'Local';

$txt['rate_qtDisable'] = 'Disable';
$txt['rate_qtEnable'] = 'Enable';
$txt['rate_qtDefault'] = 'Set Default';
$txt['rate_qtLocal'] = 'Set Local';
$txt['rate_qtGo'] = 'Go!';
$txt['rate_qtConfirm'] = 'Are you sure?';

$txt['rate_undefined_type'] = 'Undefined type input.';
$txt['rate_undefined_id'] = 'Undefined ID input.';
$txt['rate_undefined_board'] = 'Undefined board input.';
$txt['rate_missing_info'] = 'There are missing info need to be passed.';
$txt['rate_not_allowed'] = 'You are not allowed to rate.';
$txt['rate_not_in_range'] = 'Your rating is not in range.';

$txt['rate_average'] = 'Average Rating';
$txt['rate_topicNew'] = 'Rate Topic:';
$txt['rate_topicAgain'] = 'Change your rate:';
$txt['rate_topicGo'] = 'Go!';

$txt['rate_logTitle'] = 'Rating Log';
$txt['rate_logRate'] = 'Rating';
$txt['rate_logTime'] = 'Time';
// Topic Rating Mod

./Themes/default/languages/Modifications.english-utf8.php

Find (at the end of the file): [Select]
?>
Add Before: [Select]

// Topic Rating Mod
$txt['rate_adminTitle'] = 'Topic Rating Admin';
$txt['rate_adminHelp'] = 'This panel gives you possibilty to change the Topic Rating settings.';
$txt['rate_adminDesc'] = 'Topic Rating control panel.';
$txt['rate_defaultTitle'] = 'Default Settings';
$txt['rate_defaultDesc'] = 'Panel which allows you to change default settings for the mod.';
$txt['rate_boardsTitle'] = 'Board Settings';
$txt['rate_boardsDesc'] = 'Panel which allows you to change board specific settings for the mod.';

$txt['rate_enabled'] = 'Enable Topic Rating?';
$txt['rate_againType'] = 'Rate again type:';
$txt['rate_againTypeOp'] = 'Disable|Change Rating|Rate Again';
$txt['rate_againWait'] = 'Rate again wait time:';
$txt['rate_showMessageIndex'] = 'Topic Ratings on Message Index?';
$txt['rate_showMessageIndexOp'] = 'Disable|Exclude Sticky|Enable';
$txt['rate_excludedGroups'] = 'Excluded Groups:';

$txt['rate_reset'] = 'Reset Topic Ratings';
$txt['rate_resetConfirm'] = 'Are you sure to reset topic ratings?';
$txt['rate_resetSuccess'] = 'All topic ratings are reset.';
$txt['rate_resetFail'] = 'An Error Occured: Topic Rating could not be reset.';

$txt['rate_boardsName'] = 'Name';
$txt['rate_boardsModify'] = 'Modify';
$txt['rate_typeDefault'] = 'Default';
$txt['rate_typeLocal'] = 'Local';

$txt['rate_qtDisable'] = 'Disable';
$txt['rate_qtEnable'] = 'Enable';
$txt['rate_qtDefault'] = 'Set Default';
$txt['rate_qtLocal'] = 'Set Local';
$txt['rate_qtGo'] = 'Go!';
$txt['rate_qtConfirm'] = 'Are you sure?';

$txt['rate_undefined_type'] = 'Undefined type input.';
$txt['rate_undefined_id'] = 'Undefined ID input.';
$txt['rate_undefined_board'] = 'Undefined board input.';
$txt['rate_missing_info'] = 'There are missing info need to be passed.';
$txt['rate_not_allowed'] = 'You are not allowed to rate.';
$txt['rate_not_in_range'] = 'Your rating is not in range.';

$txt['rate_average'] = 'Average Rating';
$txt['rate_topicNew'] = 'Rate Topic:';
$txt['rate_topicAgain'] = 'Change your rate:';
$txt['rate_topicGo'] = 'Go!';

$txt['rate_logTitle'] = 'Rating Log';
$txt['rate_logRate'] = 'Rating';
$txt['rate_logTime'] = 'Time';
// Topic Rating Mod
This operation isn't vital to the installation of this mod.

Code

install.php

This file should be able to execute standalone.

File Operations

Move the included file "RateAdmin.php" to "./Sources".
Move the included file "Subs-Rate.php" to "./Sources".
Move the included file "RateAdmin.template.php" to "./Themes/default".
Move the included file "tr0.png" to "./Themes/default/images".
Move the included file "tr1.png" to "./Themes/default/images".
Move the included file "tr2.png" to "./Themes/default/images".
Move the included file "tr3.png" to "./Themes/default/images".
Move the included file "tr4.png" to "./Themes/default/images".
Move the included file "tr5.png" to "./Themes/default/images".