MyBB Community Forums

Full Version: [Core Edit] View Unanswered Threads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This will add a new specialized Search preset link "View Unanswered Threads" to header.

Open template header_welcomeblock_member_search and add at the bottom:
<li><a href="{$mybb->settings['bburl']}/search.php?action=findunansweredthreads">View Unanswered Threads</a></li>
 
Now open your search.php file in an editor. Go to line no. around 1252, find this line:
elseif($mybb->input['action'] == "finduserthreads")

and change it to:
elseif($mybb->input['action'] == "finduserthreads" || $mybb->input['action'] == "findunansweredthreads")

Just after that, find this line:
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";

and change it to:
 
    if($mybb->input['action'] == "finduserthreads")
    {
        $where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";
    }
    else
    {
        $where_sql = "replies='0'";
    }

Now save the modified search.php and reupload to your forum root, replacing the existing one.

Result:

[Image: 112095966-71db1980-8bc3-11eb-936d-2c72f7197633.gif]
+1 useful addition, should be in core
excellent, it will be very useful, thank you very much
Cool idea!

I would suggest to make that change in one line only to strictly keep the count of lines to rely on for future code investigations.
My replacement code example:
$where_sql = ($mybb->input['action'] == "finduserthreads") ? "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'" : "replies='0'";

[ExiTuS]
I suppose this could be an plugin. Anyways, nice core edit.