Author

Topic: Minor cosmetic change in total logged time. (Read 287 times)

copper member
Activity: 630
Merit: 420
We are Bitcoin!
I'm not discussing how general get/post requests work (and the other two main requests you can make).

Im suggesting looking at the URL to see that everything loads from the same page (index.php).
Sorry my bad. I lost focus somehow - looking at the URL, it's obvious that all the pages (except few special pages) are loading from index page.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
I am pretty sure that there is a common header file which loads with all the pages except few special pages like you mentioned.
Every page loads the smf banner at the top, the smf banner at the bottom (the custom code by theymos) and the information specific to the parameter passed to it.
I have no idea about the coding structure of smf but what I said was for in general coding style.

There are just different things passed as parameters per pages.
Like: https://bitcointalk.org/index.php?action=post;quote=37842121;topic=3956687.0 - loads a link to add a new reply - with two extra parameter added though I'm not sure I should include them.
These are the $_GET parameters we are talking about which we can see, there are $_POST parameters as well IMO which we are not seeing at all.

I'm not discussing how general get/post requests work (and the other two main requests you can make).

Im suggesting looking at the URL to see that everything loads from the same page (index.php).
If the array was (,1 hours,1 minutes) would that still get picked up by your code or do you have to look at the individual indexes in more detail? (I haven't used php very much).
Here are the arrays:
[1 days, 1 hours, 1 minutes]
[1 day, 1 hour, 1 minute]
Any instance of the something in the first array is replaced with the item in the second array of the same index. It does this for every instance.



I guess no, it should be done through localization or translation files if necessary.
I may be incorrect, but I believe this forum only supports English. Since this is the case, and the forum only supports one theme, the code would only have to be replaced in one place.
That, and due to the way that SMF works trying to change this through localization files would be massively complicating things when only one language is available.

Yes English is the only avaliable language for banners.

And I didn't realise it checked every record individually, that's quite efficient.
copper member
Activity: 630
Merit: 420
We are Bitcoin!
I am pretty sure that there is a common header file which loads with all the pages except few special pages like you mentioned.
Every page loads the smf banner at the top, the smf banner at the bottom (the custom code by theymos) and the information specific to the parameter passed to it.
I have no idea about the coding structure of smf but what I said was for in general coding style.

There are just different things passed as parameters per pages.
Like: https://bitcointalk.org/index.php?action=post;quote=37842121;topic=3956687.0 - loads a link to add a new reply - with two extra parameter added though I'm not sure I should include them.
These are the $_GET parameters we are talking about which we can see, there are $_POST parameters as well IMO which we are not seeing at all.
legendary
Activity: 2352
Merit: 1268
In Memory of Zepher
If the array was (,1 hours,1 minutes) would that still get picked up by your code or do you have to look at the individual indexes in more detail? (I haven't used php very much).
Here are the arrays:
[1 days, 1 hours, 1 minutes]
[1 day, 1 hour, 1 minute]
Any instance of the something in the first array is replaced with the item in the second array of the same index. It does this for every instance.



I guess no, it should be done through localization or translation files if necessary.
I may be incorrect, but I believe this forum only supports English. Since this is the case, and the forum only supports one theme, the code would only have to be replaced in one place.
That, and due to the way that SMF works trying to change this through localization files would be massively complicating things when only one language is available.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
The majority of the forum uses the same file (index.php).
I am pretty sure that there is a common header file which loads with all the pages except few special pages like you mentioned.

There are just different things passed as parameters per pages.
Like: https://bitcointalk.org/index.php?action=post;quote=37842121;topic=3956687.0 - loads a link to add a new reply - with two extra parameter added though I'm not sure I should include them.

Every page loads the smf banner at the top, the smf banner at the bottom (the custom code by theymos) and the information specific to the parameter passed to it.
copper member
Activity: 630
Merit: 420
We are Bitcoin!
The majority of the forum uses the same file (index.php).
I am pretty sure that there is a common header file which loads with all the pages except few special pages like you mentioned.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
I will say that it's fairly pointless, although here's some adapted code to fix this anyway:

/Themes/default/index.template.php line 256:


I guess no, it should be done through localization or translation files if necessary.

But not going to happen since there would be so many places to be checked

e.g.
Posts:  <--- User stats & Home page where user have only one post
Topics    <--- home page in case of single topic
Child Boards    <---- Where is single child board in

The majority of the forum uses the same file (index.php). Most of the stuff comes through that. Other than things like the seclog and modlpg which are separate.

This is the link to the post I just made:
https://bitcointalk.org/index.php?topic=3956687.new#new
copper member
Activity: 1526
Merit: 2890
I will say that it's fairly pointless, although here's some adapted code to fix this anyway:

/Themes/default/index.template.php line 256:


I guess no, it should be done through localization or translation files if necessary.

But not going to happen since there would be so many places to be checked

e.g.
Posts:  <--- User stats & Home page where user have only one post
Topics    <--- home page in case of single topic
Child Boards    <---- Where is single child board in
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
I will say that it's fairly pointless, although here's some adapted code to fix this anyway:

/Themes/default/index.template.php line 256:
Code:
// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'];

$timeString = '';

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
$timeString .= $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
$timeString .= $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
$timeString .= $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '
';

echo str_replace(array('1 days', '1 hours', '1 minutes'), array('1 day', '1 hour', '1 minute'), $timeString);
}

If the array was (,1 hours,1 minutes) would that still get picked up by your code or do you have to look at the individual indexes in more detail? (I haven't used php very much).
legendary
Activity: 2352
Merit: 1268
In Memory of Zepher
I will say that it's fairly pointless, although here's some adapted code to fix this anyway:

/Themes/default/index.template.php line 256:
Code:
// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'];

$timeString = '';

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
$timeString .= $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
$timeString .= $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
$timeString .= $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '
';

echo str_replace(array('1 days', '1 hours', '1 minutes'), array('1 day', '1 hour', '1 minute'), $timeString);
}
hero member
Activity: 1022
Merit: 564
Need some spare btc for a new PC
Well since that "problem" occurs only for one hour, I don't think it's needed to be fixed at all. :/ also, that time you've spent should just be in hours, if you ask me.
copper member
Activity: 630
Merit: 420
We are Bitcoin!
I don't think this will get fixed.

It's such a large fix for something that isn't really an issue and it alwo means an extra few lines of code that need to be loaded before the forum loads to validate the time. It's easier just to go with the plural version, it only makes a difference once every 60 minutes (for minutes), once every day (for hours) and only once for days.

Like I said in the original post it really is not a big deal. It's not a large fix by the way. Few lines in a function/method only to be loaded once every-time the page loads.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
I don't think this will get fixed.

It's such a large fix for something that isn't really an issue and it alwo means an extra few lines of code that need to be loaded before the forum loads to validate the time. It's easier just to go with the plural version, it only makes a difference once every 60 minutes (for minutes), once every day (for hours) and only once for days.
copper member
Activity: 630
Merit: 420
We are Bitcoin!
I am pretty sure there are so many stuffs to be taken care of however if - by any chance, can this be taken care of?


I just noticed it. Shouldn't it be: "1 hour" instead of "1 hours"?

This leads me to think, may be the "days" and "minutes" are also functioning the same when it's 1 like: 1 days and 1 minutes.

Again not a big deal. It's not even noticeable however wouldn't it be nice to see it to be fixed.
(I know, the dev will need to write a function to determine when to add "s" and when to remove "s" and it's not gonna take much time for someone who is practising programming)

PS: Don't get surprised by seeing my logged time. I joined the forum on December 14, 2017. Since then (except 34 days) I am literally spending everyday whole day on the forum LOL
Jump to: