The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
I need help making this plugin,..
I'd like to be able to display the (postdate/time, username, thread title, and post content) for the latest 5/10 threads from a specific forum/s?
Is there anyway to make a plug-in so I could put a variable where it's needed. Similiar to this here (which only displays 10 latest post - showing only the thread title and username): Code:
$numposts='10'; $thrdqry = $vbulletin->db->query_read(" SELECT forumid,threadid, title, dateline, lastpost, visible, open, lastposter FROM " . TABLE_PREFIX . "thread WHERE forumid IN (1, 2, 3) AND visible = '1' ORDER BY lastpost DESC LIMIT 0, $numposts "); while ($thrds = mysql_fetch_array($thrdqry)) { $ttid = $thrds[threadid]; $pstqry = $vbulletin->db->query_read(" SELECT postid FROM " . TABLE_PREFIX . "post WHERE threadid= $ttid ORDER BY postid DESC"); $psts = mysql_fetch_array($pstqry); $pstid = $psts[postid]; $homepage_recentpost .=<<<EOD $thrds[title] $thrds[lastposter] EOD; } $db->free_result($thrds); $db->free_result($psts); the I just post $homepage_recentpost into a template and vB does the rest, some help would be greatly appreciated,.. |
#2
|
|||
|
|||
You could do this:
PHP Code:
This doesn't check permissions of course, but maybe you're not worried about that. A bigger problem is that this doesn't handle bbcode in the text. |
#3
|
|||
|
|||
Quote:
Thanks in advance,. |
#4
|
|||
|
|||
It does sound like it should be easy, but I'm afraid I don't understand what you want.
|
#5
|
|||
|
|||
Quote:
When someone has posted in forums 1,2, or 3. Displays the Username for who posted. Displays the Title of the thread that they posted in. Displays the Date & Time when they posted. I would like it to display: When someone has started a new thread (not a post) in forums 1,2, or 3. Displays the Username for who started the thread (not the last poster). Displays the Title of the new thread. Displays the Date & Time when the new thread was posted. Once again, thanks for helping me out. |
#6
|
|||
|
|||
OK, I think I see now. I think if you change lastpostid to firstpostid, and order by thread.dateline instead of lastpost that might do it. (There's a dateline in post as well, I don't know if the dateline of the first post is the same as the thread dateline or not. If not you might have to change post.dateline to thread.dateline on the SELECT line).
ETA: the answer seems to be that thread.dateline and dateline of the first post are sometimes different but I don't know why - maybe someone else does? |
#7
|
|||
|
|||
Awesome man, I can't appreciate it enough. I almost have it working- you might as well say it is. Last question, swear. Any way to pull the threads id into it as well? I'm trying to wrap the threads title with an href leading to the thread it's pulling, you'll see what I mean:
HTML Code:
$numposts='10'; $thrdqry = $vbulletin->db->query_read(" SELECT thread.title, username, post.dateline, post.pagetext FROM " . TABLE_PREFIX . "thread AS thread LEFT JOIN " . TABLE_PREFIX . "post AS post ON thread.firstpostid = post.postid WHERE thread.forumid IN (61, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 130, 131, 132, 133, 134, 136, 137, 138, 139) AND thread.visible = '1' ORDER BY thread.dateline DESC LIMIT 0, $numposts "); while ($thrds = $vbulletin->db->fetch_array($thrdqry)) { $postdate = vbdate($vbulletin->options['dateformat'], $thrds['dateline'], true); $posttime = vbdate($vbulletin->options['timeformat'], $thrds['dateline']); $homepage_recentpost .=<<<EOD <div class="post-1 post type-post hentry category-uncategorized" id="post-1"> <h2 class="title"><a href="showthread.php?t=THREADID" target="_blank" alt="$thrds[title]" title="$thrds[title]"> $thrds[title] </a> </h2> <div class="postdate"> <img src="images/date.png" /> $postdate <img src="images/user.png" /> $thrds[username] </div> <div class="entry"> <p>$thrds[pagetext]</p><br/><a href="showthread.php?t=THREADID" target="_blank" alt="$thrds[title]" title="$thrds[title]"> Read more.. </a><br/> </div> </div> EOD; } |
#8
|
|||
|
|||
You can add any field from the thread or post db tables just by adding it after SELECT. So if you add thread.threadid to the list of columns after SELECT you can use $thrds[threadid] to get your id.
|
#9
|
|||
|
|||
Hell yeah, thanks a million bro, you made my life soo much easier..
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|