vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Yesterday/Today Datestamp Hack (https://vborg.vbsupport.ru/showthread.php?t=34527)

bigmattyh 02-26-2002 02:44 PM

Quote:

Originally posted by Lucky
Any chance of getting this hack to work for all instances, such as You last visited: 02-26-2002 12:43 AM.
Lucky:

This instance requires on additional hack. Here it is:

In index.php, around line 250, find this block of code:
PHP Code:

if (isset($bbforumview[$forum['forumid']]) and $bbforumview[$forum['forumid']]>$bbuserinfo['lastvisit']) {
    
$userlastvisit=$bbforumview[$forum['forumid']];
} else {
    
$userlastvisit=$bbuserinfo['lastvisit'];


After this block, just insert the following line:
PHP Code:

$bbuserinfo['lastvisitdate'] = vbdate($dateformat$bbuserinfo['lastvisit']); 

This should fix this particular instance. Thanks for the tip!

Slowly but surely, the exceptions to this hack are finding there way out of the woodwork. There shouldn't be more than one or two more after this one -- if any.

r.cakir 03-07-2002 08:21 AM

Hello bigmattyh
Maybe you can help me with this odd problem: I can't use the attached zip-file in your first post. After it's downloaded, decompressed and opened in a Editor (BBEdit) I see only unusable code. I use Mac OS X 10.1.3 and I don't have problems with all other downloads on this Board, except for this one.

It's possible for you to send me the file with Email ?

Thanks!

Kohhal 03-08-2002 10:03 AM

Quote:

Originally posted by Lucky
Any chance of getting this hack to work for all instances, such as You last visited: 02-26-2002 12:43 AM.
I want to get this working too but instead of it showing "You last visited: Today."(which the additional hack you supplied does) I want it to show the time too ie. "You last visited Today 12:43 AM."
Is this possible? How do I do it?

Cheers,

G :)

Ps. Great hack :up:

bigmattyh 03-08-2002 05:43 PM

Thanks for the thumbs up!

Here's how you do what you're looking to do. By the way, this isn't directly related to my hack, but it does get the job done.

In index.php, around line 260, you'll see this line:
PHP Code:

$bbuserinfo['lastvisitdate'] = vbdate($dateformat$bbuserinfo['lastvisit']); 

Immediately after it, insert this line:
PHP Code:

$bbuserinfo['lastvisitdate'] .= " at " vbdate($timeformat$bbuserinfo['lastvisit']); 

And you're set. I think you can probably figure out how to customize this. For example, if you want it to say, "You last visited Today, at 8:33 PM", you'd just insert a comma before the " at " in the above line.

That's it. :)

Okiewan 03-08-2002 09:15 PM

Very nice.. thank you!

sTive 03-10-2002 02:29 PM

Is there anybody who tried to use it under vb2.2.3b ?

bigmattyh 03-10-2002 06:51 PM

I haven't installed vB 2.2.3 -- mostly because I don't want to upgrade now and then have to upgrade again when vB 3 comes out (hopefully next month).

Are you having problems with the hack under 2.2.3? If so, I can try to look into it for you.

FWC 03-10-2002 10:49 PM

Quote:

Originally posted by bigmattyh
Are you having problems with the hack under 2.2.3? If so, I can try to look into it for you.
I upgraded from 2.2.2 to 2.2.4 this morning and this hack is working fine.

Recon_Boy 03-11-2002 02:12 AM

Quote:

Originally posted by FWC
I upgraded from 2.2.2 to 2.2.4 this morning and this hack is working fine.
Same here.

Kohhal 03-11-2002 08:49 AM

Quote:

Originally posted by bigmattyh
...Here's how you do what you're looking to do...
Perfect, thanks a lot. Installed perfectly :)

mersey 03-11-2002 10:04 AM

very nice cheers m8 :)
im on 2.2.4 np here :)

sTive 03-12-2002 10:26 AM

I have it working now. Thanks a lot ;)

JulianD 03-15-2002 01:57 AM

Working sweet here with 2.2.4

cerebro 03-16-2002 06:53 PM

Nice Hack!...i traslate to spanish...jejeje really easy

bigmattyh 03-16-2002 11:13 PM

Wow... English, German, and now Spanish!

Cool.

julius 03-18-2002 01:47 PM

It would possible to change only the date color instead of changing with "Today" and letting yesterday date inaltereded by the code?
This to left the index page well formatted in the lastpost column.

Destee 03-18-2002 04:15 PM

Another Happy Camper ... 2.2.4 ... Thank You Bigmattyh.

bigmattyh 03-18-2002 06:41 PM

Quote:

Originally posted by julius
It would possible to change only the date color instead of changing with "Today" and letting yesterday date inaltereded by the code?

That sounds interesting... If I get some free time this week, I'll write it.

julius 03-18-2002 10:00 PM

Thanks! :)

LamBras 03-21-2002 03:11 PM

I want to use this hack on a German board, and everytime I try to replace $date="Today"; with $date="heute"; I get a parse error.
What do I miss?

Thanks.

bigmattyh 03-21-2002 03:37 PM

I'm not sure why you'd be getting a parse error, unless you made some sort of mistake when editing the code. The lines should read exactly like this:

PHP Code:

if ($date==$todaydate) {
  
$date="heute";


PS -- I'll be out of town for a couple of days, so anyone needs support, hold tight until Saturday!

Kohhal 03-22-2002 10:31 AM

Quote:

Originally posted by LamBras
I want to use this hack on a German board, and everytime I try to replace $date="Today"; with $date="heute"; I get a parse error.
I had a similiar problem. I wanted to replace "Today" with "Today at" and couldn't get it to work either :disappointed:
I'd be interested to know what's going wrong?

LamBras 03-22-2002 11:10 AM

There might be a fixed length needed?

When replacing "today" with "heute", all is well.
When replacing "yesterday" with it's German correspondant "gestern", there occurs an error. When I chose " gestern" (mark the two leading blanks), all is well again.

Strange, maybe someone can enlighten us?

bigmattyh 03-23-2002 05:43 AM

TheMasterG, LamBras:

I can't seem to replicate this problem on my own board.

What version of PHP are you running?

LamBras 03-23-2002 08:06 AM

4.0.6

bigmattyh 03-23-2002 02:34 PM

Well, honestly, I'm stumped. There should be no reason that you can't change what's in the quotes for $date="".

Stumped, I tells you. Stumped.

LamBras 03-23-2002 04:04 PM

I can change it, but it must have the same length as "today" and "yesterday". Well, the workaround is using blanks. :)

r.cakir 03-24-2002 03:38 PM

I use this hack also on a german Board. Without any problems. :surprised:

Hubsi 03-30-2002 07:00 AM

thx for this hack, great work ;)

Hubsi

pHAZE_1 04-19-2002 03:23 AM

it doesnt work.. i did everything correct twice and nothing shows up. ????

bigmattyh 04-20-2002 05:59 PM

Quote:

it doesnt work.. i did everything correct twice and nothing shows up. ????
Well, keep in mind that as a couple of new versions of vB have come out, the line references are slightly off. For example, in functions.php, the replacement code for vbdate() is a few dozen lines further down.

I don't know if that's the problem you're encountering, but if you do the replacements correctly, the hack should be working correctly.

Chris M 04-20-2002 06:10 PM

Das hack war sehr gut...

It works on 2.2.5...

I am living proof of that:D

*Holy Cr*p - Heart Attack :confused:*:):D

Satan

UGate 04-28-2002 11:05 PM

Wie kann ich Today in einer Farbe machen z.b.rot

Today in red ?

Hubsi 04-28-2002 11:17 PM

wie w?rs mit z.b.

PHP Code:

$date="<font color=red>Heute</font>"

;)

HyperS 04-29-2002 01:35 PM

Great Hack man! Superb work.

KeithMcL 05-01-2002 07:36 AM

Strange - I installed this hack yesterday (2002-04-30) and had a look at my memberlist to see if it worked, but I couldn't see any one who had joined for "Today" or "Yesterday".

I then had a look at it again this morning (2002-05-01) and those that registered yesterday i'm seeing them as being registered "Today" and not seeing anyone as being registered "Yesterday" even though some people have.

My forums can be found at www.webdevforums.com

Any help Big Matt would be appreciated.

bigmattyh 05-01-2002 10:13 AM

Hi Keith,

I took a look at your members list, and like you, I found that vB was reporting that two people registered Today. But then the next most recent registration is on 26-04-02 (4-5 days ago).

I need some more info to see if there's a problem. Could you post the datestamps from when Lisle and chachet joined, and could you also let me know the timezone of your server?

Thanks,
Matt

http://www.webdevforums.com/memberli...hat=datejoined

Aaow AnD wHiTe 05-01-2002 02:06 PM

Thanx for this great hack, Matt. Is really useful!! Would it be possible to make the word "Today" template-based? Cause we have a Spanish and an English template, and our english users keep seeing "Hoy" (spanish word for "Today") and it's a little confusing :(

Thanx in advance for your help!! ^__^

bigmattyh 05-01-2002 05:05 PM

Aaow and White (and anyone else who is interested in a template-based version of this hack):

Here is how to convert this hack so that it uses templates.

First, find this block of code:
PHP Code:

    if ($date==$todaydate) {
      
$date="Today";
    }
    if (
$date==$yestdate) {
      
$date="Yesterday";
    } 

... and replace it with this:
PHP Code:

    if ($date==$todaydate) {
      eval(
"\$date= \" ".gettemplate('today')."\";");
    }
    if (
$date==$yestdate) {
      eval(
"\$date= \" ".gettemplate('yesterday')."\";");
    } 

Then create 2 custom templates, called "today" and "yesterday". Within these templates, just type the word you want to appear for today and yesterday. You can do this for as many template sets as you want -- vB will pick the right one from the current style setting.

Hope this helps,
Matt

inetd 05-03-2002 01:17 PM

[high]* inetd click install button :)[/high]


All times are GMT. The time now is 04:41 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01593 seconds
  • Memory Usage 1,831KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete