List own user threads from specific forum in menu
#1
I know people don't like to be asked for code without even a clue, but I still hope for help.

What I want to do is something like this:

<?php
      $query = $db->query("
            SELECT threads from users where ID=($mybb->user['uid'])
            and WHERE FID = 12,22,53
            ORDER BY title DESC
        );
?>

This is not a real code, I simple write some stuff there. I have no coding experience.

In english language:
1. Get the user id from logged in user
2. Get all threads of him from specific forums
3. List them by title with a link to it

Could somebody make a real code out of my mess above? Angel

What I can do is the html and css around it, to list the threads from specific forums for the user in the menu.^^

I would be happy to post the finished work here.

A user in the German MYBB Support Forum helped me and wrote this code for me.

But it brings a white site on the admin plugin site.

<?php

$plugins->add_hook("global_start", "myheadermenu_threadlist");
function myheadermenu_threadlist()
{
    global $mybb, $db, $headermenu_threadlist;
    $headermenu_threadlist = "";
    if(!$mybb->user['uid'])
    {
        return;
    }
    $query = $db->simple_select("threads", "tid, subject", "uid = '{$mybb->user['uid']}' AND fid IN ('22,23,14') AND visible=1 AND closed NOT LIKE 'moved|%'", array("order_by" => 'dateline', "order_dir" => 'DESC'));
    $count = $db->num_rows($query);
    if($count > 0)
    {
        $headermenu_threadlist = "<div class=\"dropdown\">
<a class=\"first\" href=\"#\">Themen-Liste</a>
<div class=\"dropdown-content\">";
        while($result = $db->fetch_array($query))
        {
            $headermenu_threadlist .= "<a href=" . get_thread_link($result['tid']) . ">" . htmlspecialchars_uni($result['subject']) . "</a>";
        }
        $headermenu_threadlist .= "</div>
</div>"
    }
} 
?>

Anybody knows why?
Reply


Messages In This Thread
List own user threads from specific forum in menu - by skrilaxrev - 2020-01-23, 05:11 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)