Adding a 'Mark Solved' Option to vBulletin 3.0.x
Edit file Postings.php
1. Find:
case 'deletethread':
case 'deleteposts':
case 'movethread':
case 'editthread':
And add:
case 'solvethread':
immediately below.
2. Find:
// ############################### start update thread ###############################
if ($_POST['do'] == 'updatethread')
above it add:
// ###################### start solve thread #####################################
if ($_REQUEST['do'] == 'solvethread')
{
// Reindex first post to set up title properly.
$getfirstpost = $DB_site->query_first("
SELECT postid, title, userid, pagetext
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadid
ORDER BY dateline
LIMIT 1
");
// only mods with the correct permissions should be able to access this
if (($getfirstpost['userid']!=$bbuserinfo['userid'])&&!can_moderate($threadinfo['forumid'], 'caneditthreads'))
{
print_no_permission();
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
$notes = construct_phrase($vbphrase['thread_edited_by_x_on_y_at_z'], $bbuserinfo['username'], vbdate($vboptions['dateformat'], TIMENOW), vbdate($vboptions['timeformat'], TIMENOW)) . ' ' . $notes;
if (strtolower(substr($getfirstpost['title'],0,8))!='solved: ') {
$getfirstpost['threadtitle'] = "Solved: ".$getfirstpost['title'];
delete_post_index($getfirstpost['postid'], $getfirstpost['title'], $getfirstpost['pagetext']);
build_post_index($getfirstpost['postid'] , $foruminfo, 1, $getfirstpost);
$DB_site->query("
UPDATE " . TABLE_PREFIX . "thread SET
title = CONCAT('Solved: ',title),
notes = '" . addslashes($notes) . "'
WHERE threadid = $threadid
");
build_forum_counters($threadinfo['forumid']);
log_moderator_action($threadinfo, construct_phrase($vbphrase['thread_edited_visible_x_open_y'], $visible, $open));
$DB_site->query("
UPDATE " . TABLE_PREFIX . "post SET
title = CONCAT('Solved: ',title) WHERE postid = $getfirstpost[postid]");
}
$url = "showthread.php?$session[sessionurl]t=$threadid";
eval(print_standard_redirect('redirect_editthread'));
}
Edit file showthread.php
Find:
// #############################################################################
// Setup Add Poll Conditional
Above it add:
// ##############################################################################
// display mark solved if appropriate
$getfirstpost = $DB_site->query_first("
SELECT userid
FROM " . TABLE_PREFIX . "post
WHERE threadid = ".$threadinfo['threadid']."
ORDER BY dateline
LIMIT 1
");
if ($getfirstpost['userid']==$bbuserinfo['userid']) {
$show['marksolved']=true;
} else {
$show['marksolved']=false;
}
Edit template SHOWTHREAD
Find:
<div><label For="ao_edt"><input type="radio" name="do" id="ao_edt" value="editthread" />
$vbphrase[edit_thread]</label></div>
Above it add:
<div><label For="ao_sol"><input type="radio" name="do" id="ao_sol" value="solvethread" />
Mark Solved</label></div>
Find:
</if> </form> </div> <!-- / thread tools menu -->
Above it add:
<else /><if condition="$show['marksolved']">
<tr>
<td class="vbmenu_option" title="nohilite">
<div><label For="ao_sol"><input type="radio" name="do" id="ao_sol" value="solvethread" />Mark Solved</label></div>
<tr>
<td class="vbmenu_option" title="nohilite" align="center">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="t" value="$threadid" />
<input type="hidden" name="pollid" value="$pollid" />
<input type="submit" class="button" value="$vbphrase[perform_action]" />
</if>
Now save the template and upload the new files.
I recommend you keep a backup of the old php files before doing so though.