PDA

View Full Version : Best method of grabbing user's threads, categorised?


Oblivion Knight
25 Feb 2006, 16:06
I'm working on a little something to manage the content of my site via vBadvanced CMPS, without it being displayed publically on the forum home..

However, for the "Content Editor", I'm struggling to come up with a way to pull a user's threads AND have them categorised per forum basis. I imagine that I'll have to use an array, or a foreach loop of some kind for this - but I'm not that great with either..


Here's my current file:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

While I could attempt to "borrow" some of vB's code for the 'Find all threads started by X' feature, I don't need any permission checking code because the tool is only accessible to staff anyway - and I'd rather try and understand how to code more efficiently (also, I dare say that the search.php file is a jungle of code to break down and navigate through for exactly what I require)..

Marco van Herwaarden
25 Feb 2006, 16:22
Change "ORDER BY dateline DESC" to "ORDER BY forumid, dateline DESC" in your query.

Oblivion Knight
25 Feb 2006, 16:48
Heh, perhaps I should have explained a little better.. ;)

I'm displaying the output in a select box, but I want to categorise the <option>s with <optgroup>s.
So effectively..


BEFORE:

Article 3
Article 2
Article 1


AFTER:

Category A
Article 3
Article 1
Category B
Article 2


Although you're right, I will need to add that to the query.! :p



---EDIT---
I've done it by adding a count for every forumid for now..

It's kinda dirty though, so if anyone has a better way - I'd love to hear it.! ;)