MyBB Community Forums

Full Version: [Resolved All] ModCP attachments, Quick Login and Thread moving
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Nope, it doesn't:

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

Edit: I fixed it after taking a look at the attachments table and the code:

Replace the old code with this on line 1202:
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=a.aid)
Apologies, I really wasn't thinking.

Change (circa line 1202)

LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

to

LEFT JOIN ".TABLE_PREFIX."threads t ON (a.pid=t.tid)

It might work better than the last one I said! That's because there is no "tid" in the attachments table...
(2008-11-06, 01:13 PM)Tom.M Wrote: [ -> ]Apologies, I really wasn't thinking.

Change (circa line 1202)

LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

to

LEFT JOIN ".TABLE_PREFIX."threads t ON (a.pid=t.tid)

It might work better than the last one I said! That's because there is no "tid" in the attachments table...

Nope that won't work. pid != tid. aid != tid either so most likely you would have to join in the posts table.
Okay, I'm starting to figure out the Quick Login bug.

I commented out
$plugins->run_hooks("member_do_login_start");
And then it worked, so I'm pretty sure the bug is in the MyBB Login Converter plugin. I'll take a look at that now.

Edit: Fixed it!
The problem was that the quick login password is submitted as plain text (i.e. it's not encrypted) and the password argument in the user/pass validation function in loginconvert.php requires passwords to be encrypted with md5.
(2008-11-06, 01:36 PM)CraKteR Wrote: [ -> ]Nope that won't work. pid != tid. aid != tid either so most likely you would have to join in the posts table.

Have an idea... because attachments and topics aren't linked, why is topics even joined?! This makes sense to me, and it works for me too (I was having the same problem), but a developer will probably shoot me for this...

Replace the $query with:

		$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}
		");
Err, I already fixed it Toungue

Post #11 in this thread:
http://community.mybboard.net/thread-400...#pid269144

Thanks anyway Wink
(2008-11-06, 01:56 PM)ZeroFreeze Wrote: [ -> ]Err, I already fixed it Toungue

Post #11 in this thread:
http://community.mybboard.net/thread-400...#pid269144

Thanks anyway Wink

Wrong Toungue

Although it works, the query isn't correct. What you're asking it to do is find attachments that are connected to threads. You need the query to find attachments that are connected to posts. I corrected the solution in your bug file:

ModCP Attachment Moderation
That's missing something though Toungue

Here's the correct solution:
		$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'])))."){$flist}
		");


Anyway, thanks for the help, guys!

P.S: I also fixed the quick login bug. The solution is in post #14.
Pages: 1 2