The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Help me show
I use the following code inserted hook forumbit_display and it has taken time of the last post, now I need to get the time of the first post (time when create topic), anyone can help me, thanks a lot.
PHP Code:
|
#2
|
|||
|
|||
The information on the last post is saved in the forum table, but what you want isn't there so you'd have to add a query to get it.
|
#3
|
|||
|
|||
You can guide me to select the table and should have what conditions? Please give me an example.
SELECT * what ? WHERE ? |
#4
|
|||
|
|||
Actually now that I've looked at some more code, I think you can piggy back it on another query so you don't have to add one. To try that, create a new plugin using hook cache_ordered_forums and code like this:
Code:
$counter_select .= ', thread.dateline AS lastthreaddateline '; $tachyjoin .= ' LEFT JOIN ' . TABLE_PREFIX . 'thread AS thread ON(lastthreadid = thread.threadid)'; and then you should be able to use $forum['lastthreaddateline'] in your plugin (but I haven't tried it at all). Edit: ...but I'm not sure if that's right now that I think about it. I don't know if the lastthreadid is the last thread created or the last thread that someone posted in. |
#5
|
|||
|
|||
Quote:
I have to try and error Code:
Database error in vBulletin 4.2.0: Invalid SQL: SELECT subscribeforumid, forum.forumid, forum.lastpost, forum.lastposter, forum.lastposterid, forum.lastthread, forum.lastthreadid, forum.lasticonid, forum.threadcount, forum.replycount, forum.lastpostid, forum.lastprefixid, thread.threadid, thread.field6 AS field6, thread.field7 AS field7, thread.dateline AS lastthreaddateline , user.usergroupid, user.homepage, user.options AS useroptions, IF(userlist.friend = 'yes', 1, 0) AS isfriend, user.lastactivity, user.lastvisit, IF(user.options & 512, 1, 0) AS invisible FROM forum AS forum LEFT JOIN subscribeforum AS subscribeforum ON (subscribeforum.forumid = forum.forumid AND subscribeforum.userid = 1) LEFT JOIN user AS user ON (user.userid = forum.lastposterid) LEFT JOIN userlist AS userlist ON (userlist.relationid = user.userid AND userlist.type = 'buddy' AND userlist.userid = 1) LEFT JOIN thread AS thread ON (thread.threadid=forum.lastthreadid) LEFT JOIN thread AS thread ON(lastthreadid = thread.threadid); MySQL Error : Not unique table/alias: 'thread' Error Number : 1066 Request Date : Wednesday, January 23rd 2013 @ 12:31:43 AM Error Date : Wednesday, January 23rd 2013 @ 12:31:43 AM Script : http://localhost/forum.php Referrer : http://localhost/showthread.php?t=571&p=815 IP Address : 123.19.70.155 Username : Admin Classname : vB_Database MySQL Version : 5.3.8-MariaDB Stack Trace: #0 vB_Database->halt() called in [path]\includes\class_core.php on line 426 #1 vB_Database->execute_query() called in [path]\includes\class_core.php on line 473 #2 vB_Database->query_read_slave() called in [path]\includes\functions.php on line 4901 #3 cache_ordered_forums() called in [path]\forum.php on line 594 and use code PHP Code:
Code:
Unknown column 'lastthreaddateline' in 'field list' |
#6
|
|||
|
|||
oops, it looks like you already have another plugin doing something similar? Try commenting out the $tachyjoin line in the code I posted and see if that works (although it seems like it's not quite correct since forum.lastthreadid could be different from lastthreadid if it's for a user in global ignore).
|
#7
|
|||
|
|||
Quote:
Yeah, sorry, I deleted that because I'm now confused as to whether or not lastthreadid is the thread you want. In any case it should have been "SELECT dateline AS lastthreaddateline" (or just "SELECT dateline", but I was trying to make it consistent with the other pluigin code I posted). Edit nvm, it looks like the lastthread information *is* the info for the last thread posted in, so (if I understood you correctly) it is what you want. |
#8
|
|||
|
|||
I have not seen any code works
|
#9
|
|||
|
|||
Did you try the cache_ordered_forums plugin with just this one line of code:
Code:
$counter_select .= ', thread.dateline AS lastthreaddateline '; or try the query in your plugin using this: Code:
"SELECT dateline AS lastthreaddateline FROM " . TABLE_PREFIX . "thread WHERE threadid = " . $forum['lastthreadid'] or are you saying you've tried those (without errors) but it's still not working? |
#10
|
|||
|
|||
edit....
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|