TinyPortal

Development => Support => Topic started by: JPDeni on July 15, 2006, 06:26:14 PM

Title: Using user date format
Post by: JPDeni on July 15, 2006, 06:26:14 PM
I'm making a php block to do some stuff with the Calendar and I would like to display it with the user's preferred date format. The dates from the database are in "yyyy-mm-dd" format. How would I translate that into the format that the users have defined in their profiles?
Title: Re: Using user date format
Post by: IchBin on July 16, 2006, 03:19:24 AM
For something like that you'd have to add a database call to access what preference the user has set for that option.
Title: Re: Using user date format
Post by: JPDeni on July 16, 2006, 05:43:52 AM
That sounds logical.  :) Thank you.

Is there a list somewhere of the defined variables that are available for us to use? For example, what variable would I use to access the user's ID_MEMBER number?
Title: Re: Using user date format
Post by: IchBin on July 16, 2006, 06:59:50 AM
I wish there was a list....
I'm unsure how to call every ID. Something Bloc or some other code savy person will have to do.
Title: Re: Using user date format
Post by: JPDeni on July 16, 2006, 03:35:24 PM
Thank you for that. "I don't know" is a valid response. :) I'll go hunting to see what I can find.

Edited to add...

In reading another topic, I found that the user id is in the variable $context['user']['id']. One down. A zillion to go.  ;)
Title: Re: Using user date format
Post by: agridoc on July 16, 2006, 05:00:09 PM
If that helps, $context['current_time'] is the variable for current time. Found in index.template.php.

I wanted to do something with languages in the past and was searching for language variables, fortunately Bloc and Feline did the job in 0.9x  :laugh:
Title: Re: Using user date format
Post by: JPDeni on July 16, 2006, 05:15:03 PM
You know, you guys are going to have to stop talking about 9.x until it's available for the rest of us. It's getting really frustrating to know what's coming, but not when it's going to be here.  ;)

The thing that I wanted to do was to list all upcoming events (or the n next-occurring events), no matter how far they are in the future. I thought it would be nice to put the date in the user's preferred format, but now I realize that I wouldn't be able to control the size of the output and it might look funky. But it's always nice to get more information.
Title: Re: Using user date format
Post by: agridoc on July 16, 2006, 05:47:32 PM
JPDeni something like you are trying to do is interesting for me too.

It' s a part of features of an extended calendar that I am trying to put in the Roadmap for 1.0 and Bloc has shown some interest.

I have experience with both SMF and TP as a tester. A developer wants to be sure that no major bugs will be present when a new version will be public. TP is still beta but is actually stable when properly installed.

Stop talking about 9.x? How would you feel if you had worked to add something that you wanted and is not present in current version and see after a few days that it is contained in the new version and nobody informed you about it when asking help?
Title: Re: Using user date format
Post by: JPDeni on July 16, 2006, 06:24:51 PM
QuoteStop talking about 9.x? How would you feel if you had worked to add something that you wanted and is not present in current version and see after a few days that it is contained in the new version and nobody informed you about it when asking help?
I was just kidding. Really, what I (and a whole lot of the rest of us) want is to see it for ourselves! I know you know that, too, but I just thought I'd mention my frustration -- with a ;) to indicate that I wasn't really serious.

I really do understand that the developer wants to be sure it's stable enough to release. I want it to be stable, too. I think I can understand the mechanism behind development and wish the newest version was available now, both at the same time.

As for my list of upcoming events, all it took was to copy ssi_recentEvents into a php block and to remove one line of the code. Specifically, I took out
cal.startDate <= '" . strftime('%Y-%m-%d', forum_time(false)) . "'
AND

and then played around with the output a bit.
Title: Re: Using user date format
Post by: G6Cad on July 16, 2006, 06:29:34 PM
I think i have to invite agridoc for a cup of tea on my cafe' ;)

The next release is well wanted arround here now :) We all feel that it is near a release now, another week or at the end of the month if next test goes well :)
Title: Re: Using user date format
Post by: agridoc on July 16, 2006, 07:33:51 PM
But G6, I am a "regular" in G6' CafÃÆ'Ã,©  ;)

Especially when Tinyportal.net is down (I cross my fingers  ::) ).
Title: Re: Using user date format
Post by: G6Cad on July 16, 2006, 09:12:38 PM
I know :) But i haven't offer any cups of tea yet  ;D
I have ice tea here and it is really great when you feel warm and want something cold :)
Well, this went off topic i guess  :o