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)

Bugz 07-04-2002 12:58 AM

Code:

UPGRADING FROM VERSION 1:

1.        Open functions.php, in your /forum/admin/ directory.
2.        Scroll down to around line 1500, where you should find the altered version of the function vbdate (which you modified in version 1 of this hack). This function ends with the following lines:

  } else {
  $date = date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
  }
  return $date;
}

3.        After this block of code, add the following block:

function vbdatenoty($format,$timestamp) {
  global $bbuserinfo,$timeoffset;

  return date($format,$timestamp+($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
}

when i do this i get this error

Code:

Fatal error: Cannot redeclare vbdatenoty() (previously declared in /home/bugz/public_html/vb/admin/functions.php:1633) in /home/bugz/public_html/vb/admin/functions.php on line 1660
i am runnign 2.2.6 php version 4.2.1 . any ideas ?

Bugz 07-04-2002 03:19 AM

you sould really change the install file that ptoblem i had before.

its already in the code. and because it was in there twice i was getting that error


also my member list sais i reged "Today, at " and thats it any way to fix this ?

http://vb.bugz.m-c-web.com/memberlist.php?s=

Gary King 07-05-2002 02:41 PM

Nice hack! Gonna install it now :)

bigmattyh 07-05-2002 02:41 PM

Quote:

Originally posted by Bugz
Fatal error: Cannot redeclare vbdatenoty() (previously declared in /home/bugz/public_html/vb/admin/functions.php:1633) in /home/bugz/public_html/vb/admin/functions.php on line 1660
Hi Bugz,

The function vbdatenoty() isn't a standard vb function, so I'm guessing you probably pasted it twice without knowing it... or something. I made that function up, and named it, so if you didn't paste it twice, some other hack you installed decided to use that same name (although I wouldn't know why).

As for your second post, I can't see what you're talking about. I visited your forums, and the Last Visited date (the only recent date I can get) is working fine.

PeterNRG 07-06-2002 09:09 AM

As cool as this hack is, I think you can take it a bit further.

I believe that people don't really have an idea how old a post is by looking at a date or timestamp. I think it would be much cooler to give them this kind of information:

1 minute old
5 minutes old
35 minutes old
1 hour old
5 hours old
2 days old
2 weeks old
etc....

Or maybe with the correct date between brackets, like this:
5 minutes old (07-07-2002 15:15).

Another feature of this "TIME POSTED AGO" hack could be that the admin can specify a period of when the normal date should be displayed again. For example, if a post is older than 1 month, then it will not display the '1 month old' message, but simple the date.

I've seen this feature on other boards, take a look for example at http://www.dpreview.com/forums/forum.asp?forum=1002 (it's not a vb board though), it seems like it works very well there, and you get an immediate idea of how old posts are.

What do you think? Am I making any sence ? :)

Bugz 07-07-2002 07:19 PM

this is my members list looks like when somone regesters on like today.

i made a test user today.

sorry for the image quality im not on my comp and was forced to use MSpaint.

Bugz 07-07-2002 11:44 PM

Quote:

Originally posted by PeterNRG
As cool as this hack is, I think you can take it a bit further.

I believe that people don't really have an idea how old a post is by looking at a date or timestamp. I think it would be much cooler to give them this kind of information:

1 minute old
5 minutes old
35 minutes old
1 hour old
5 hours old
2 days old
2 weeks old
etc....

Or maybe with the correct date between brackets, like this:
5 minutes old (07-07-2002 15:15).

Another feature of this "TIME POSTED AGO" hack could be that the admin can specify a period of when the normal date should be displayed again. For example, if a post is older than 1 month, then it will not display the '1 month old' message, but simple the date.

I've seen this feature on other boards, take a look for example at http://www.dpreview.com/forums/forum.asp?forum=1002 (it's not a vb board though), it seems like it works very well there, and you get an immediate idea of how old posts are.

What do you think? Am I making any sence ? :)

i dont know php nor asp but i do know that there totally diffrent type of programming. so i assume it would be maby difficult to do this in a vb (php) prgramming

bigmattyh 07-08-2002 03:33 PM

It could be done. I'll look at it today, and if it isn't too time-consuming, I'll write a separate hack for it.

Bugz 07-08-2002 03:45 PM

Quote:

Originally posted by Bugz
this is my members list looks like when somone regesters on like today.

i made a test user today.

sorry for the image quality im not on my comp and was forced to use MSpaint.

......

bigmattyh 07-09-2002 09:56 PM

Quote:

Originally posted by Bugz

......

Yes, I figured that one out. You're only seeing "Today, at ______" because you must have applied the "at" variation to this hack (found here) somewhere other than the "Last visited" date.

You can't use the "at" modification within vbdate() itself -- not the way vB is written. You should only use the "at" modification in specific places where you want to see "at". It isn't appropriate in many places because vB only passes a date -- and not a time -- to many displayed dates throughout the system.

Hope that helps.

Bugz 07-10-2002 12:27 AM

Quote:

Originally posted by bigmattyh
Yes, I figured that one out. You're only seeing "Today, at ______" because you must have applied the "at" variation to this hack (found here) somewhere other than the "Last visited" date.

You can't use the "at" modification within vbdate() itself -- not the way vB is written. You should only use the "at" modification in specific places where you want to see "at". It isn't appropriate in many places because vB only passes a date -- and not a time -- to many displayed dates throughout the system.

Hope that helps.

ill try that out.

Bugz 07-10-2002 12:46 AM

[high]* Bugz kicks bugz in the ass !
[/high]

i just relized the member list doesnt show the time they registerd.

lol even after you posted that about the time i didnt understand..

well i put , at in the template after today and such thats why it was showing. :)

good hack

bigmattyh 07-10-2002 04:35 PM

I'm glad you got it to work. :)

rootnik 07-16-2002 12:10 AM

This is awesome, thanks bigmattyh!

Martin64 07-17-2002 07:09 PM

Sweet hack - it's the first one that took less than one minute to implent. :D

[high]* Martin64 clicks install[/high]

asweetdeal 07-21-2002 03:58 PM

Help! I installed the hack and it works wonderfully, and my Mods love it, however, I have now lost the date (not the time) in my posts... what did I do wrong? Using vbulletin 2.5

Thanks!
ASweetDeal

bigmattyh 07-30-2002 07:11 PM

Hey ASweetDeal,

I'd recommend checking out your templates. This hack doesn't do anything to eliminate the dates from anything, because of the way vB handles dates and times. You might try comparing the templates of the affected areas with the originals and seeing if there are any changes. If that doesn't work, I'll wrack my brain for more. :)

Matt

bigmattyh 08-05-2002 06:19 PM

Woo hoo!!!

Made it into vB3!!!

Sha na na na na na na na na na! Ka blammo!

Learner29 08-09-2002 06:34 PM

thank you thank you thank you

I installed this hack and it is straightforward.....

it works very nicely ...

I even translated it and it works on non -english forums.... ;-)

2 X Viverridae 08-14-2002 01:04 PM

Couldn't wait fer it to come out in vB3 - installed!

Thanks!

Craigr 08-17-2002 01:52 PM

Excellent hack worked great.

Craig

ExAvIoUr 08-19-2002 03:46 PM

Quote:

Originally posted by bigmattyh
If you would like your date to be formatted in the "Today, at 08:33 PM" format, here's how to do so:

When you install the hack, just insert ", at" into this line:
Code:

eval("\$bbuserinfo[lastvisitdate] = \"".vbdate($dateformat,$bbuserinfo[lastvisit]).
" , at ".vbdate($timeformat,$bbuserinfo[lastvisit])."\";");

That's all!

i can't find that code in index.php. can ne1 help me?

bigmattyh 08-19-2002 08:46 PM

Quote:

Originally posted by ExAvIoUr
i can't find that code in index.php. can ne1 help me?
It's towards the beginning of index.php. Keep in mind that it doesn't include the ", at" part of the code (the part in red). Just search for the first part of the string.

Tim Wheatley 08-23-2002 05:58 PM

Can this be used with 'yesterday' 'today' on 2.2.6?

ExAvIoUr 08-23-2002 06:44 PM

Quote:

Originally posted by bigmattyh
It's towards the beginning of index.php. Keep in mind that it doesn't include the ", at" part of the code (the part in red). Just search for the first part of the string.
i still can't find it. do u mean admin/index.php?

bigmattyh 08-23-2002 06:57 PM

Quote:

Originally posted by Tim Wheatley
Can this be used with 'yesterday' 'today' on 2.2.6?
If you're asking if it works on 2.2.6, yes.

Quote:

Originally posted by ExAvIoUr
i still can't find it. do u mean admin/index.php?
No. The line is around line 53 of your forum/index.php file. All you're doing is looking for a line that looks like this:
Code:

eval("\$bbuserinfo[lastvisitdate] = \"".vbdate($dateformat,$bbuserinfo[lastvisit]).
" ".vbdate($timeformat,$bbuserinfo[lastvisit])."\";");

and turning it into this:
Code:

eval("\$bbuserinfo[lastvisitdate] = \"".vbdate($dateformat,$bbuserinfo[lastvisit]).
", at ".vbdate($timeformat,$bbuserinfo[lastvisit])."\";");


Tim Wheatley 08-23-2002 07:55 PM

lol... Sorry. I meant to post that in Firefly's 'let users choose their own date format' thread, I had them both open at the same time.

Googa 08-23-2002 08:09 PM

Works well. Good hack! Thanks

ExAvIoUr 08-24-2002 07:44 PM

the closest thing i have to that is this

PHP Code:

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

is that it. and where do i put that.

ExAvIoUr 08-26-2002 10:49 PM

bump

bigmattyh 08-26-2002 10:51 PM

Quote:

Originally posted by ExAvIoUr
the closest thing i have to that is this

PHP Code:

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

is that it. and where do i put that.

I don't know what you're trying to do. What's the problem?

ExAvIoUr 08-26-2002 11:02 PM

i am trying to get the word at in there. so it couls say yesterday "AT" blah blah. in the forumhome.

i am trying to find this code:

PHP Code:

eval("\$bbuserinfo[lastvisitdate] = \"".vbdate($dateformat,$bbuserinfo[lastvisit]).
" , at ".vbdate($timeformat,$bbuserinfo[lastvisit])."\";"); 

the closest that i have is this:
PHP Code:

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

do u get it

Boofo 08-26-2002 11:11 PM

Change this:

Quote:

$bbuserinfo['lastvisitdate'] = vbdate($dateformat, $bbuserinfo['lastvisit']);
$bbuserinfo['lastvisitdate'] = " at " . vbdate($timeformat, $bbuserinfo['lastvisit']);
to this:

Quote:

eval("\$bbuserinfo[lastvisitdate] = \"".vbdate($dateformat,$bbuserinfo[lastvisit]).
" at ".vbdate($timeformat,$bbuserinfo[lastvisit])."\";");

ExAvIoUr 08-26-2002 11:18 PM

i changed it and its the same. no change to it.

i will check it over to make sure i have done it right.

bigmattyh 08-26-2002 11:19 PM

Okay.

You aren't supposed to be looking for
PHP Code:

eval("\$bbuserinfo[lastvisitdate] = \"".vbdate($dateformat,$bbuserinfo[lastvisit]).
", at ".vbdate($timeformat,$bbuserinfo[lastvisit])."\";"); 

You're supposed to be replacing the existing $bbuserinfo[lastvisitdate] lines with that line.

Replace your lines that you have with the above line.


And finally, if you're trying to insert ", at" into every instance where the date is called, this isn't the way to do it. The way to do it is through templates... But you probably know that since you've at least scanned through this thread to find an answer to your question.

Boofo 08-26-2002 11:20 PM

Make sure you have it right below this:

Quote:

// if user is know, then welcome

Boofo 08-26-2002 11:24 PM

That doesn't quite work with ALL of the dates, although most of them can be changed through the templates. The editpost.php is one place for example that you have to change the date and time hardcode to be able to use "at" with it. :)

Quote:

Originally posted by bigmattyh
And finally, if you're trying to insert ", at" into every instance where the date is called, this isn't the way to do it. The way to do it is through templates... But you probably know that since you've at least scanned through this thread to find an answer to your question.

ExAvIoUr 08-26-2002 11:36 PM

bigmattyh, u lost me with ur post. what exactly am i suppose to do?

bigmattyh 08-26-2002 11:51 PM

We'll do this like a choose-your-own-adventure.

#1: What are you trying to accomplish?
If you want to insert ", at" into the "You last visited" line on your index home page, go to #2!
If you want to insert ", at" into other dates -- not just the "You last visited" line, go to #3!


#2: You want to insert ", at" into the "You last visited" line on your index home page. Simple. Just do this. If that fails, re-read the instructions on how to do this. There's a link in the first post of this thread.

#3: You want to insert ", at" into other dates -- not just the "You last visited" line. Then you'll have to learn more. Start by reading through the posts to this thread. For some date conversions, yes, it's necessary to hack the code, but for many of them, you'll have to change your templates, which is very easy to do.

In any case, you need to read through the posts of this thread, because your issue has been brought up about half a dozen times before, and answered. I have faith that you'll be able to figure out not only how this hack works but how to fix it, too. If you still need help after you've read all the posts and you've looked at the code and tried to figure it out, I will be happy to help you further. ;)

ExAvIoUr 08-27-2002 12:00 AM

in post 86 that the one that i want to do.

how do i do it?


All times are GMT. The time now is 02:24 AM.

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.01509 seconds
  • Memory Usage 1,854KB
  • 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
  • (5)bbcode_code_printable
  • (5)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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