SimplePortal

Customization => Custom Coding => Topic started by: Malibuz0r on August 28, 2012, 10:29:16 PM

Title: "Today" and "Yesterday" in shoutbox dates?
Post by: Malibuz0r on August 28, 2012, 10:29:16 PM
Hey guys, as you know, the date in the shoutbox is under the "Username: Message"

I'm trying to make it like: "[Today | 01:39:37 PM] Username: Message" (in a single line)
When the message was a few days ago: "[Month day | 01:39:37 PM] Username: Message"

Thanks for the awesome portal btw!
Title: Re: Rearranging the date on the shoutbox.
Post by: AngelinaBelle on August 30, 2012, 08:36:32 AM
Simple Portal does not do that, by default. This would take a little customization of the Shoutbox code, to figure out when the date is "Today" or "Yesterday".  But quite doable.  I am going to move your request to a custom coding board.  I hope you will find the help you need.
Title: Re: "Today" and "Yesterday" in shoutbox dates?
Post by: Malibuz0r on August 30, 2012, 06:17:42 PM
No no no. ( I really suck at explaining so yeah :d)

Look. Right now this is how the date displays in the shoutbox:

"AngelinaBelle: appu2002 -- Welcome to Simple Portal. How do you like it?
Today at 05:59:43 AM" < Default

I want something like:

"[Today | 05:59:43 AM] AngelinaBelle: appu2002 -- Welcome to Simple Portal. How do you like it?"
The following would be the same:
"[August 27, 2012 | 12:45:33 AM] phantomm: I think that he's asking for ban, but is too shy to say it"

Hope you or anyone else can understand what I mean. I'm guessing a few changes in the code, but not sure how or which.

Thanks.
Title: Re: "Today" and "Yesterday" in shoutbox dates?
Post by: AngelinaBelle on September 04, 2012, 12:39:46 PM
I understand now.

In the shoutbox, you would like to change the order of the information.  Instead of a separate line for the author and the date of a shout, you would like the date and author in-line with the shout.

You MIGHT LIKE to add the "today" calculation.  But I am not certain.

* When a page is loaded, all the shouts in the shoutbox block are loaded using the function template_shoutbox_all, which calls either template_shoutbox_all_curve or template_shoutbox_all_core, depending on the current theme.  These functions are found in PortalShoutbox.template.php.
* When the shoutbox is refreshed, automatically or by using the refresh button, javascript is used instead. You will find this in function onShoutReceived, in the file portal.js

You may re-arrange the order of shout author, time, and text in any way it pleases you.
For consistancy, you may wish to make sure that you do it the same way in both locations.

You will probably want to test on a "test" forum before you make your changes go "live" on your real forum.
SimplePortal 2.3.8 © 2008-2024, SimplePortal