Current time: 03-20-2010, 02:05 AM Hello There, Guest! (LoginRegister)


[D] ModCP attachment moderation
11-06-2008, 01:06 PM (This post was last modified: 11-07-2008 09:53 AM by ZeroFreeze.)
Post: #1
[D] ModCP attachment moderation
When trying to moderate (i.e. ignore/delete/approve) unapproved attachments in the ModCP (modcp.php?action=modqueue), I get the following error:

Quote:SQL Error:
1054 - Unknown column 'p.tid' in 'on clause'
Query:
SELECT a.pid, a.aid FROM attachments a LEFT JOIN threads t ON (t.tid=p.tid) WHERE aid IN (3,4,5,6,8,11)

Solution:
Replace the query starting on line 1197 with this:
PHP Code:
$query $db->query("
            SELECT a.pid, a.aid
            FROM  "
.TABLE_PREFIX."attachments a
            LEFT JOIN "
.TABLE_PREFIX."posts p ON (a.pid=p.pid)
            LEFT JOIN "
.TABLE_PREFIX."threads t ON (t.tid=p.tid)
            WHERE aid IN ("
.implode(","array_map("intval"array_keys($mybb->input['attachments'])))."){$tflist}
        "
); 
Find all posts by this user
11-06-2008, 02:01 PM
Post: #2
RE: ModCP attachment moderation
Attachments and threads don't have any connections. It's attachments and posts that are connected...

Solution
Replace...

PHP Code:
        $query $db->query("
            SELECT a.pid, a.aid
            FROM  "
.TABLE_PREFIX."attachments a
            LEFT JOIN "
.TABLE_PREFIX."threads t ON (t.tid=p.tid)
            WHERE aid IN ("
.implode(","array_map("intval"array_keys($mybb->input['attachments'])))."){$flist}
        "
); 

...with...

PHP Code:
$query $db->query("
            SELECT a.pid, a.aid
            FROM  "
.TABLE_PREFIX."attachments a
            LEFT JOIN "
.TABLE_PREFIX."posts p ON (a.pid=p.pid)
            WHERE aid IN ("
.implode(","array_map("intval"array_keys($mybb->input['attachments'])))."){$flist}
        "
); 

Tomm M
MyBB Developer ยป Marketing Designer & Systems Developer
Find all posts by this user


Forum Jump: