MyBB Community Forums

Full Version: Mybb User Recently viewed thereads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I list the last topics a user entered?
There are a lot of different plugins on the extend site, many for this purpose but I personally use Recent Threads on Index by dragonexpert.
(2023-10-06, 11:19 AM)Taylor M Wrote: [ -> ]There are a lot of different plugins on the extend site, many for this purpose but I personally use Recent Threads on Index by dragonexpert.


I want to add the user's last entered topics to the plugin I use.

Help me I made arrangements and added the topics entered by the user to the database and I want to pull them in the order they were added.

The code I use
if ($_REQUEST['type'] == 'songezilen') {
    // Kullanıcının kimliğini alın
    $uid = (int)$mybb->user['uid'];
    $query = "
    SELECT stabview.tid
    FROM ".TABLE_PREFIX." sonkonu AS  sonkonu 
    WHERE 
sonkonu.uid = $uid
    ORDER BY  sonkonu .time DESC";
    $result = $db->query($query);
    if ($db->num_rows($result) > 0) {
        $tidArray = array();
        while ($row = $db->fetch_array($result)) {
            $tidArray[] = $row['tid'];
        }
        $tidList = implode(",", $tidArray);
        $queryselect = 'fid, tid, uid, username, dateline, lastpost, lastposter, lastposteruid, views, replies, subject, prefix';
        $queryfrom = 'threads';
        $querycond = "tid IN ($tidList)";
        $queryorder = 'stabview.time DESC';
        $ sonkonu _adrow =  sonkonu _queryresult($queryselect, $queryfrom, $querycond, $queryorder, count($tidArray), NULL, 'sonkonu_adrow', 1);
    }
}

Error:
[12-Oct-2023 16:02:52 UTC] PHP Fatal error:  Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tid IN (9,9,10,10,4,10)
	ORDER BY stabview.time DESC
	DESC LIMIT 6' at line 3 in /home/grafikla/public_html/inc/db_mysqli.php:340
Stack trace:
#0 /home/grafikla/public_html/inc/db_mysqli.php(340): mysqli_query()
#1 /home/grafikla/public_html/inc/plugins/sonkonu.php(317): DB_MySQLi->query()
#2 /home/grafikla/public_html/inc/plugins/sonukonu.php(455): sonkonu_queryresult()
#3 /home/grafikla/public_html/inc/class_plugins.php(142): sonkonu_pro()
#4 /home/grafikla/public_html/xmlhttp.php(205): pluginSystem->run_hooks()
#5 {main}
  thrown in /home/grafikla/public_html/inc/db_mysqli.php on line 340