Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Threadlist Sorting by Custom Thread Field = SQL Error
JasonSta Offline
Junior Member
**
Posts: 2
Joined: Mar 2013
Post: #1
Threadlist Sorting by Custom Thread Field = SQL Error
Greetings!  I Set-up my very first (feedback) forum with one single plugin, being XYTreads (of course :] ),

If you want to see
http://softimageinput.netne.net/

Everything essentially went quite nicely..

I added a custom field with a key named "tag",

and added a custom field column in the threadlist
showing each posts value for this new "tag" field (being wonderful)

and I can now filter by this new field, which is also (very) wonderful.


BUT! .. *sorting* by this field returns an error saying
_________________________
SQL Error:
1054 - Unknown column 't.tf_tag' in 'order clause'

Query:
SELECT t.*, tfd.`tag` AS `xthreads_tag`, (t.totalratings/t.numratings) AS averagerating, t.username AS threadusername, u.username FROM mbb_threads t LEFT JOIN mbb_users u ON (u.uid = t.uid) LEFT JOIN `mbb_threadfields_data` tfd ON t.tid=tfd.tid WHERE t.fid='2' AND t.visible='1' ORDER BY t.sticky DESC, t.tf_tagkey desc LIMIT 0, 20
______________________

Why is it looking for the preceding 't.'?   and where is 'order clause'

I added in forumdisplay.php  ::

case "tf_tag":
$sortfield = "tf_tag";
break;


and I setup the column header sorting link in the Template: forumdisplay_threadlist

but even just entering in the adressbar:

http://softimageinput.netne.net/forumdis...http://softimageinput.netne.net/forumdisplay.php?fid=2&sor

returns that same error Frown

The doc is straightforward enough saying:

  << To sort by a thread field, prefix its key with tf_, for example,
       forumdisplay.php?fid=2&sortby=tf_myfield   will sort the threads by myfield. >>

Having tried many things over several days, and searched all over the net,
if anyone could say if I'm doing something wrong, or otherwise missed something,
it would be very much appreciated,

thanks!

Jason


EDIT: Just so you know if you visit the site, the key (and all references) has been renamed from 'tag' to 'tagkey'
(This post was last modified: 03-27-2013 03:00 PM by JasonSta.)
03-27-2013 01:16 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Threadlist Sorting by Custom Thread Field = SQL Error
I don't get an SQL error when visiting the page you linked.
Please revert that code edit - it will not work.

I'm not sure what's causing your SQL error.  Do you have any additional plugins which may be conflicting?

My Blog
03-27-2013 05:52 PM
Find all posts by this user Quote this message in a reply
JasonSta Offline
Junior Member
**
Posts: 2
Joined: Mar 2013
Post: #3
RE: Threadlist Sorting by Custom Thread Field = SQL Error
You are right!  ...  it works!  (today)

Perhaps one of my last edits did the trick
but with absolutely No Idea what I did for it to work Eyes

Maybe it was a typo  Smile

in any event, thanks for your quick reply!

cheers,
Jason
03-28-2013 03:57 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: