PDA

View Full Version : Thread Start date/time


nuno
26 May 2001, 17:15
Inspired in wluke's hack:

open forumdisplay.php

find code:

$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
lastposter,thread.dateline,

replace it with:

$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
lastposter,thread.dateline AS threadstart,

find code:(2x)

$thread[lastreplydate]=vbdate($dateformat,$thread[lastpost]);
$thread[lastreplytime]=vbdate($timeformat,$thread[lastpost]);

insert after it:

$thread[threadstartdate]=vbdate($dateformat,$thread[threadstart]);
$thread[threadstarttime]=vbdate($timeformat,$thread[threadstart]);

save and close forumdisplay.php

edit forumdisplaybit template

find:

<td bgcolor="{secondaltcolor}" width="30%" nowrap><normalfont>$thread[postedby]

replace it with:

<td bgcolor="{secondaltcolor}" width="30%" nowrap><smallfont>$thread[threadstartdate] <font color="{timecolor}">$thread[threadstarttime]</font><br> by $thread[postedby]</smallfont></td>

save it

done

RobAC
26 May 2001, 17:28
What does this hack do and where can we see an example of it?

h4p3
26 May 2001, 17:41
It displays you when the thread was started.

For example:
thread starter
nuno
on 05-26-2001 05:28 PM

nuno
26 May 2001, 17:55

Rosevalley
26 May 2001, 23:11
Nice hack man !!! its working great ! easy to install, i had it working in 3 minutes. nice !!!

My members are very happy now, tnx again.

RoseValleY

BluSmurf
26 May 2001, 23:36
Great hack :), install it with ease!

JJR512
27 May 2001, 10:33
Odd. I've been doing the same thing all along, only my version is much simpler.

Here are my instructions for the same thing:

Find this code in forumdisplay.php: (NOTE: it appears TWICE. You are looking ONLY for the SECOND instance of this code!)
$thread[lastreplydate]=vbdate($dateformat,$thread[lastpost]);
$thread[lastreplytime]=vbdate($timeformat,$thread[lastpost]);

...and after the SECOND instance of the above code, add:
$thread[firstpostdate]=vbdate($dateformat,$thread[dateline]);
$thread[firstposttime]=vbdate($timeformat,$thread[dateline]);

Save and upload the file.

Next, edit the forumdisplaybit template. Look for:
<normalfont>$thread[postedby]</normalfont>
...and replace it with this:
<smallfont>$thread[firstpostdate] $thread[firstposttime]<br>by <b>$thread[postedby]</b></smallfont>
ALSO, in the opening <td> tag that this bit is in, you should add this:
align="right"
This alignment, along with the formatting in the replacement code, will give the thread start time and started by username the same appearance as in the column for the last reply time and last reply user. But you can feel free, of course, to give it your own desired style.

***
So you can see the differences between my version and nuno's version is that I get the thread start time and date from the dateline directly: "$timeformat,$thread[dateline]", whereas in nuno's version you have to edit a select query earlier in the code, and get the start time and date from the query results. It's just simpler this way, although obviously either way works. :)

Example: http://www.jjr512.com/forums/forumdisplay.php?s=&forumid=1

JJR512
27 May 2001, 10:37
I'd also like to add that in the forumdisplay_threadslist template, I changed Thread Starter to Thread Started, because with the new information in that column, the word "started" is more accurate. It follows more naturally: "Thread Started date by username", rather than "Thread Starter date by username". :)

webhost
03 Jun 2001, 15:13
Thanks For the hack, worked great!



Joey

ethank
03 Jun 2001, 18:41
One issue that I can't figure out is why the username link is underlined in the "Thread Started" column, but not in the Last Post column. I followed the instructions to the letter! :)

Ethan

JJR512
03 Jun 2001, 19:36
ethank, that's not the case with my board. Which version of the hack did you use, mine or nuno's?

zarkov
04 Jun 2001, 00:33
ethank, the thread starter was already "underlined" without this hack and the last post members name wasnt.

It has nothing to do with the hack m8, Although i cant see where the underline is comming from

west
04 Jun 2001, 03:37
thanks a lot /\/uno !!!

it was very simple and it works great and now my members

are very pleased...

:)

hacker
03 Oct 2001, 16:37
Originally posted by Zarkov
ethank, the thread starter was already "underlined" without this hack and the last post members name wasnt.

It has nothing to do with the hack m8, Although i cant see where the underline is comming from

I applied the hack, but the color of the time is not the same as in Last Post.

almighty one
04 Oct 2001, 01:26
just my opinion but wouldnt it look better if it had the posters name then the date and time? maybe it is easy to do i havent even tried to install it maybe ill do this and have the name appeare above time thanx for hack

hacker
04 Oct 2001, 05:09
While looks are subjective, I prefer a consistent look with the Last Post, inlcuding no undeline and red time in Thread Starter. Anyone know how to change them?

Thanks in advance.

YourHostSucks
04 Oct 2001, 05:12
Seems how we just launch the site last week, this is a nice feature I never thought of..

Thanks! Worked Great JJR...

almighty one, just re arrange stuff in "forumdisplaybit" template...

EX: http://forums.yourhostsucks.com/forumdisplay.php?&forumid=5

I removed by: and align=center.. not sure if I like it yet...
But the name on top is the way to go... *I think* ;)


If you would like the name on the front (last post) to be on top..

That is in "forumhome_lastpostby" template..

http://www.yourhostsucks.com

YourHostSucks
04 Oct 2001, 05:15
Originally posted by hacker
While looks are subjective, I prefer a consistent look with the Last Post, inlcuding no undeline and red time in Thread Starter. Anyone know how to change them?

Thanks in advance.

You want to remove the link to last poster profile,
and the post time?

hacker
04 Oct 2001, 05:23
No, I want the Thread Starter to look similar to Last Post, that is, the user name is not underlined and the time stamp is in red because the time stamp is also in read in Last Post.

YourHostSucks
04 Oct 2001, 05:59
In "forumdisplaybit" template :


$thread[firstpostdate] $thread[firstposttime]


Replace with:


$thread[firstpostdate] <font color="{ timecolor }">$thread[firstposttime]</font>


Note: Take the spaces out from around "timecolor"

Then I just got vBulletin a week or so ago.. So I am not sure why those links look different.. but you can remove the line by editing
forumdisplay.php

Around line 598 or so:

Find:

$thread['postedby'] = "<a href=\"member.php?action=getinfo&userid=$thread[postuserid]\">$thread[postusername]</a>";


Replace with:

$thread['postedby'] = "<a href=\"member.php?action=getinfo&userid=$thread[postuserid]\" style=\"text-decoration: none\">$thread[postusername]</a>";



...


If someone knows the proper "vBulletin" way to remove the line.. please post so.. ;)

hacker
04 Oct 2001, 07:00
THANK YOU THANK YOU THANK YOU! It worked and now the site is mroe consistent looking!

YourHostSucks
04 Oct 2001, 07:05
No Problem,, I am sure it is not the correct "vBulletin" way to do it.. (someone will prob fix my mistake)

But it works.. I modified it so all of mine are like that....

julius
19 Oct 2001, 18:51
Thanks, very usefull hack!
Is it possible to use it in "View New Posts" and in "Search - Show results as threads" ?

2 X Viverridae
14 Aug 2002, 14:59
I have installed this hack - but am still wondering...

Originally posted by julius
Thanks, very usefull hack!
Is it possible to use it in "View New Posts" and in "Search - Show results as threads" ?

Mr. X
20 Aug 2002, 07:51
Does this hack work at all for 2.2.6? I got the username showing up but no date at all on top, just a blank. The code I edit in the php file is around 597-598, and I stick the:

$thread[firstpostdate]=vbdate($dateformat,$thread[dateline]);
$thread[firstposttime]=vbdate($timeformat,$thread[dateline]);

On top of those 2 lines, in the middle, or under it? I've tried all 3 and no date is showing up.

Mr. X
21 Aug 2002, 01:44
bump

2 X Viverridae
21 Aug 2002, 21:49
@ Mr. X

I have JJR512's version working on 2.2.6 with no problems whatsoever. According to his instructions, you are looking only for the second instance of this code...
$thread[lastreplydate]=vbdate($dateformat,$thread[lastpost]);
$thread[lastreplytime]=vbdate($timeformat,$thread[lastpost]);
and add this after the second instance...
$thread[firstpostdate]=vbdate($dateformat,$thread[dateline]);
$thread[firstposttime]=vbdate($timeformat,$thread[dateline]);

Hope this helped.

EDIT: I think you have the first instance of the code, not the second - my first instance of the code to find is around line 575, and the second around 655 - while our files are obviously different, your location of around 597 or so seems likely that you've inserted the code in the wrong spot. :D

Mr. X
22 Aug 2002, 09:34
Still not working. The first instance of the code shows up at line 524 and 525 respectively. The 2nd instance shows up at 598 and 599 respectively. I posted the hack right after line 599, but it still doesnt show up. I've also reverted the forumdisplaybit back to the original and put in the code but it also doesnt show up (no date).

2 X Viverridae
22 Aug 2002, 19:08
It's always the 'simple' ones that end up being a pain, eh.

It's a little hard to tell exactly what you are seeing when you say 'no date' shows up - do you mean that it displays just like it did before?

It should show...
DD-DD-DD TT:TT AM/PM
by Thread-Starter

Now - does it show the word 'by' prior to thread starter? Or, does it just show the name? Knowing this will tell us if there is an error in the forumdisplaybit template, or if the problem is somewhere else.

The relvant portion of my forumdisplay.php looks like this...

if ($wordwrap!=0) {
$thread[title]=dowordwrap($thread[title]);
}

$thread[lastreplydate]=vbdate($dateformat,$thread[lastpost]);
$thread[lastreplytime]=vbdate($timeformat,$thread[lastpost]);
$thread[firstpostdate]=vbdate($dateformat,$thread[dateline]);
$thread[firstposttime]=vbdate($timeformat,$thread[dateline]);

$thread[gotonew]='';


If you reverted your forumdisplay bit template, then changed...

<td bgcolor="{ secondaltcolor}" width="30%" nowrap><normalfont>$thread[postedby]</normalfont></td>

to this...

<td bgcolor="{ secondaltcolor}" width="30%" align="right" nowrap><smallfont>$thread[firstpostdate] <font color="{ timecolor}">$thread[firstposttime]</font><br>by <b>$thread[postedby]</b></smallfont></td>

That should be all there is to it.

(Removing the space after the {'s in { secondaltcolor} and { timecolor} of course)

If you are still having problems, maybe a small screen shot?

Mr. X
22 Aug 2002, 20:23
Ok. I've attached a preview of how it looks. Just the date is missing.

Here is what that code looks like in my forumdisplay.php (without hack applied). These are from lines 595 to 604:

if ($wordwrap!=0) {
$thread[title]=dowordwrap($thread[title]);
}

$thread[lastreplydate]=vbdate($dateformat,$thread[lastpost]);
$thread[lastreplytime]=vbdate($timeformat,$thread[lastpost]);



$thread[gotonew]='';

I've pasted the 2 lines of code right after the 2nd instance, on line 601-602 respectively.

Here is what my forumdisplaybit template looks like:

<tr align="center">
<td bgcolor="#F1F1F1"><img src="http://www.vbulletin.org/forum/greentek/$thread[newoldhot].gif" border="0" alt=""></td>
<td bgcolor="#DFDFDF">$thread[icon]</td>
<td bgcolor="#F1F1F1" align="left" width="70%" onMouseOver="this.style.backgroundColor='#EBECEA'; this.style.cursor='hand';" onMouseOut="this.style.backgroundColor='#F1F1F1';" onClick="window.location.href='showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]'"><normalfont>$thread[gotonew] $paperclip$thread[movedprefix]$thread[typeprefix]<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[title]</a></normalfont> <smallfont>$thread[pagenav]</smallfont></td>
<td bgcolor="#DFDFDF" width="30%" valign="middle" align="right" nowrap><smallfont>$thread[postdate] $thread[posttime]<br>by <b>$thread[postedby]</b></smallfont></td>
<td bgcolor="#F1F1F1"><normalfont><a href="javascript:who($thread[threadid])">$thread[replycount]</a></normalfont></td>
<td bgcolor="#DFDFDF"><normalfont>$thread[views]</normalfont></td>
$threadrating
<td bgcolor="$backcolor">
<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink"><tr align="right">
<td nowrap><smallfont>$thread[lastreplydate] <font color="#006000">$thread[lastreplytime]</font><br>
by <a href="member.php?action=getinfo&find=lastposter&threadid=$thread[threadid]"><b>$thread[lastposter]</b></a></smallfont></td>
<td nowrap>&nbsp;<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&threadid=$thread[threadid]"><img src="http://www.vbulletin.org/forum/greentek/lastpost.gif" border="0" alt="Go to last post"></a></td>
</tr></table>
</td>
</tr>

2 X Viverridae
22 Aug 2002, 20:57
In your template you have 'postdate' and 'posttime' instead of 'firstpostdate' and 'firstposttime'

In the 5th line of your template, try changing...

<smallfont>$thread[postdate] $thread[posttime]<br>

to

<smallfont>$thread[firstpostdate] $thread[firstposttime]<br>

Hope this get's it!

Mr. X
23 Aug 2002, 06:44
Its working now. The template was weird. For some reason, my on/off graphics were linked to:

<td bgcolor="#F1F1F1"><img src="http://www.vbulletin.org/forum/greentek/$thread[newoldhot].gif" border="0" alt=""></td>

I saw the new style Im working and notice its using the same green buttons here. I freaked out at my co-designer, I thought he ripped them, but he said he didnt even touch the template. Im confused how the hell that got in there. Well I reverted back to the original template and added your code and it works great now. Just gotta reapply that CSS rollover code.

Perhaps I copied the URL by mistake and pasted in there, but I dont ever recall (certainly not today at least) wanting the URL to the new/off buttons, so I wonder wtf happened?

Well anyway thanks for all the help!

2 X Viverridae
23 Aug 2002, 09:31
LOL - don't rip on yer poor co-desingner - it's the way VB handles replacement varialbles, even in code - it's happened to all of us!

Just be careful when copying code directly from the site - if it says { imagesfolder} (without the space after the {) it will give you the local reference path to it...

Glad it's working for you now - it's a great little hack!

PS - for clarity the following are the same except for the space following the {... In both cases I typed in the word imagesfolder and imagesfolder - in the first case the {} brackets are around the statement, in the second, I left a leading space after the first { - and here is the result - the absolute local path to this installations 'imagesfolder' shows up in the first case!! Welcome to the world of replacement variables...

http://www.vbulletin.org/forum/greentek (http://www.vbulletin.org/forum/greentek)
{ imagesfolder}

In both cases, I typed in imagesfolder - but in the first example, I left no spaces between { and the name. vBulletin then parses it as the path to the local 'imagesfolder' (which is http://www.vbulletin.org/forum/greentek (http://www.vbulletin.org/forum/greentek)) - which is what happened to you. This can be annoying at times, but one of the things you have to watch for! :D

Try it for yourself and see...

Audionuts
20 Sep 2002, 15:57
cool, nice little hack