View Full Version : Last Post Date
theArchitect
09-13-2005, 04:28 AM
I have a hack on my forum home page which displays the 10 most recent posts. But next to the "Go To Last Post Button" I want to display the date (like in the forum view which is below this list).
The code I am using to show the date and time of the last post in that thread is
$lastpostinfo[lastpostdate]
But for some reason nothing is being displayed.
Any thoughts as to what I am doing wrong would be appreciated.
Marco van Herwaarden
09-13-2005, 06:17 AM
Maybe you should ask this in the thread of the hack you have installed. Maybe this info don't get queried from teh database. Difficult to give an answer without seeing the hack.
theArchitect
09-13-2005, 06:44 AM
Maybe you should ask this in the thread of the hack you have installed. Maybe this info don't get queried from teh database. Difficult to give an answer without seeing the hack.
Well, the problem is that it was a custom hack I paid for and I haven't heard from the original author for months now.
KirbyDE kindly ported it into 3.5.0 for me but I don't think he has the time to assist or I would not need to ask here.
Marco van Herwaarden
09-13-2005, 06:46 AM
Well then you should at least post the hack here, and maybe someone will be so kind to look at it. But without seeing it, there is no chance someone can guess why it doesn't work, or what to changes to make it work.
theArchitect
09-13-2005, 07:04 AM
Well then you should at least post the hack here, and maybe someone will be so kind to look at it. But without seeing it, there is no chance someone can guess why it doesn't work, or what to changes to make it work.
Sure. There is one plug-in (but I am not sure if that is needed) and then the template modification which looks like this.
<tr>
<td class="alt1Active" id="t$last[threadid]">
<div>
<a
href="showthread.php?$session[sessionurl]t=$last[threadid]"><if condition="$shownewpost"><strong><font color="#ca0000"></if>$last[title]<if condition="$shownewpost"></font></strong></if></a>
</div>
<div class="smallfont"><span style="float:$stylevar[right]">Forum: <a
href="forumdisplay.php?$session[sessionurl]f=$last[forumid]"
alt="$last[forumtitle]">$last[forumtitle]</a></span><span style="cursor:pointer"
onclick="window.open('member.php?$session[sessionurl]u=$last[postuserid]')">$last[postusername]</span>
</div>
</td>
<td class="alt2" title="<phrase 1="$last[replycount]" 2="$last[views]">$vbphrase[replies_x_views_y]</phrase>">
<div class="smallfont" style="text-align:$stylevar[right]; white-space:nowrap">
<div><phrase 1="member.php?find=lastposter&t=$last[threadid]" 2="$last[lastposter]">$vbphrase[by_x]</phrase></div> $last[lastpost] <a href="showthread.php?$session[sessionurl]goto=newpost&t=$last[threadid]" title="<phrase 1="$last[title]">$vbphrase[go_first_unread_in_thread_x]</phrase>"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="<phrase 1="$last[title]">$vbphrase[go_first_unread_in_thread_x]</phrase>" border="0" /></a>
</div>
</td>
<td class="alt1" align="center">
$last[replycount]
</td>
<td class="alt2" align="center">$last[views]</td>
</tr>
I am assuming that the $last[lastpost] is what should draw the date and time of the last post from the DB.
Do you need any other info?
Marco van Herwaarden
09-13-2005, 07:06 AM
:D
You should have posted the plugin, not the template. Not much we can see from that.
Logikos
09-13-2005, 07:08 AM
:D
You should have posted the plugin, not the template. Not much we can see from that.
I was just thinking where is the plugin... :p
theArchitect
09-13-2005, 07:29 AM
I was just thinking where is the plugin... :pSorry guys. Here you go.
Logikos
09-13-2005, 07:34 AM
So you just want the date and time of the lastpost?
theArchitect
09-13-2005, 07:41 AM
So you just want the date and time of the lastpost?
Please.
Paul M
09-13-2005, 07:42 AM
What date is $last['lastpost'] ?
(This is the code from the plugin)
$last['lastpost'] = vbdate($vboptions['dateformat'], $last['lastpost'], true);
theArchitect
09-13-2005, 07:45 AM
What date is $last['lastpost'] ?
(This is the code from the plugin)
$last['lastpost'] = vbdate($vboptions['dateformat'], $last['lastpost'], true);
I am not sure. It was the template info that I was told to use along with the plug-in.
Paul M
09-13-2005, 07:47 AM
Okay, let me rephrase - have you tried using $last[lastpost] as it would seem to suggest it is what you want.
theArchitect
09-13-2005, 07:52 AM
Okay, let me rephrase - have you tried using $last[lastpost] as it would seem to suggest it is what you want.
Sorry, my mis-understanding.
If you check the template code I quoted above I am currently using this, but nothing is displaying.
<div><phrase 1="member.php?find=lastposter&t=$last[threadid]" 2="$last[lastposter]">$vbphrase[by_x]</phrase></div> $last[lastpost] <a href="showthread.php?$session[sessionurl]goto=newpost&t=$last[threadid]" title="<phrase 1="$last[title]">$vbphrase[go_first_unread_in_thread_x]</phrase>"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="<phrase 1="$last[title]">$vbphrase[go_first_unread_in_thread_x]</phrase>" border="0" /></a>
This code should display who posted, the date/time and the Go To Last Unread post button. It does everything except the date and time.
Boofo
09-13-2005, 08:02 AM
In the plug-in, try changing this line:
$last['lastpost'] = vbdate($vboptions['dateformat'], $last['lastpost'], true);
to this:
$last['lastpost'] = vbdate($vbulletin->options['dateformat'], $last['lastpost'], true);
and see if that helps at all.
Logikos
09-13-2005, 08:09 AM
good eye booboo, I didn't even notice that... I guess 3.0 is still stuck in my physie
Boofo
09-13-2005, 08:12 AM
Lucky guess is all, as with most of my coding. ;)
theArchitect
09-13-2005, 08:27 AM
Many thanks kind Sir. That has got the date displaying.
However, the time is not next to the date, as in the forum view. Any chance of stretching a favour and asking how I correct this?
You will see from the screen shots what I mean. The first is the view in the Top 10 list, but the second is taken from the forum view and is how I would like it to look.
Boofo
09-13-2005, 08:29 AM
Many thanks kind Sir. That has got the date displaying.
However, the time is not next to the date, as in the forum view. Any chance of stretching a favour and asking how I correct this?
You will see from the screen shots what I mean. The first is the view in the Top 10 list, but the second is taken from the forum view and is how I would like it to look.
Just do a nowrap in the template for that line. ;)
Logikos
09-13-2005, 08:34 AM
Change that new code BooBoo gave you which was:
$last['lastpost'] = vbdate($vbulletin->options['dateformat'], $last['lastpost'], true);
To this:
$last['lastpost_date'] = vbdate($vbulletin->options['dateformat'], $last['lastpost'], true);
$last['lastpost_time'] = vbdate($vbulletin->options['timeformat'], $last['lastpost'], true);
Then you can use $last[lastpost_date] for the date, and $last[lastpost_time] for the time in your template... :)
Boofo
09-13-2005, 08:43 AM
You don't use true in the time line, do you? You meant this I take it? ;)
$last['lastpost_date'] = vbdate($vbulletin->options['dateformat'], $last['lastpost'], true);
$last['lastpost_time'] = vbdate($vbulletin->options['timeformat'], $last['lastpost']);
I guess I misunderstood his question. :(
theArchitect
09-13-2005, 08:53 AM
You don't use true in the time line, do you? You meant this I take it? ;)
$last['lastpost_date'] = vbdate($vbulletin->options['dateformat'], $last['lastpost'], true);
$last['lastpost_time'] = vbdate($vbulletin->options['timeformat'], $last['lastpost']);
I guess I misunderstood his question. :(
Many thanks. That has got the time to display, but it seems to have broken the date as it now looks like this
1126602934 07:15 PM
I think this is the Linux time stamp that is being shown.
<edit>
Scratch that. I haden't changed the date code so it still read $last[lastpost] rather than $last[lastpost_date].
Many thanks for your assistance. You have been a great help.
Boofo
09-13-2005, 08:58 AM
I thought that might be it. No problem. ;)
Paul M
09-13-2005, 03:48 PM
good eye booboo, I didn't even notice that... Doh, me neither ..... I was ready for bed (that's my excuse anyway ;)).
Well spotted that man.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.