MyBB Community Forums
Random Thread Link - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Requests (https://community.mybb.com/forum-65.html)
+---- Thread: Random Thread Link (/thread-126542.html)

Pages: 1 2 3


Random Thread Link - sarisisop - 2012-09-22

Anyone know how I could create a Random Thread link

Like in Wikipedia where you push "Random Article". Members would push Random Thread and it takes you to a, Well a random thread from the forum. Big Grin

Thank you.


RE: Random Thread Link - frostschutz - 2012-09-22

You would need a plugin - if you want the link to work anyway.


RE: Random Thread Link - Omar G. - 2012-09-22

This may work:
http://mybbhacks.zingaburga.com/showthread.php?tid=28


RE: Random Thread Link - sarisisop - 2012-09-22

(2012-09-22, 05:15 PM)Omar G. Wrote: This may work:
http://mybbhacks.zingaburga.com/showthread.php?tid=28

Thanks but that's a bit old, I gave a quick try but got SQL Error: 1146


RE: Random Thread Link - Omar G. - 2012-09-22

Maybe if you post the full error message we can help you to get it working.


RE: Random Thread Link - sarisisop - 2012-09-22

Oops sorry didn't think of that.

[Image: 14tklf.jpg]


RE: Random Thread Link - Yaldaram - 2012-09-22

Open plugin file and find;
$threadcount = $db->fetch_field($db->simple_select(TABLE_PREFIX.'threads', 'COUNT(*) AS threadcount', $where), 'threadcount');
and Change it into;
$threadcount = $db->fetch_field($db->simple_select('threads', 'COUNT(*) AS threadcount', $where), 'threadcount');

Next, find;
$rndtid = $db->fetch_field($db->simple_select(TABLE_PREFIX.'threads', 'tid', $where, array('limit' => 1, 'limit_start' => $rndnum)), 'tid');
and Change it into;
$rndtid = $db->fetch_field($db->simple_select('threads', 'tid', $where, array('limit' => 1, 'limit_start' => $rndnum)), 'tid');



RE: Random Thread Link - sarisisop - 2012-09-22

(2012-09-22, 09:09 PM)Yaldaram Wrote: Open plugin file and find;
$threadcount = $db->fetch_field($db->simple_select(TABLE_PREFIX.'threads', 'COUNT(*) AS threadcount', $where), 'threadcount');
and Change it into;
$threadcount = $db->fetch_field($db->simple_select('threads', 'COUNT(*) AS threadcount', $where), 'threadcount');

Next, find;
$rndtid = $db->fetch_field($db->simple_select(TABLE_PREFIX.'threads', 'tid', $where, array('limit' => 1, 'limit_start' => $rndnum)), 'tid');
and Change it into;
$rndtid = $db->fetch_field($db->simple_select('threads', 'tid', $where, array('limit' => 1, 'limit_start' => $rndnum)), 'tid');

Thanks Yaldaram, close it works when logged in, but for guests I get a blank page with "There are no threads on this board."


RE: Random Thread Link - Omar G. - 2012-09-23

Find:
$where = "closed NOT LIKE 'moved|%' AND visible <> 0$us";

Replace with:
$where = "closed NOT LIKE 'moved|%' AND visible!='0'$us";



RE: Random Thread Link - sarisisop - 2012-09-23

(2012-09-23, 01:45 AM)Omar G. Wrote: Find:
$where = "closed NOT LIKE 'moved|%' AND visible <> 0$us";

Replace with:
$where = "closed NOT LIKE 'moved|%' AND visible!='0'$us";

Hello, Didn't work still got the same result. Blank page with "There are no threads on this board."