The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Best method of grabbing user's threads, categorised?
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:
<?php // Lazy, but it works.. $userid = $vbulletin->userinfo['userid']; $forumids = "2,6"; $prevarts = $db->query_read("SELECT threadid, title, forumid FROM " . TABLE_PREFIX . "thread WHERE postuserid = $userid AND forumid IN ($forumids) ORDER BY dateline DESC"); while ($titles = $db->fetch_array($prevarts)) { $tit = $titles['title']; $tid = $titles['threadid']; $fid = $titles['forumid']; eval('$articles .= "' . fetch_template('adv_portal_contenteditorbit') . '";'); } $db->free_result($titles); eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_contenteditor') . '";'); ?> |
#2
|
|||
|
|||
Change "ORDER BY dateline DESC" to "ORDER BY forumid, dateline DESC" in your query.
|
#3
|
||||
|
||||
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.. [high]BEFORE:[/high] Article 3 Article 2 Article 1 [high]AFTER:[/high] Category A Article 3 Article 1 Category B Article 2 Although you're right, I will need to add that to the query.! [high]---EDIT---[/high] 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.! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|