Bitcoin Forum
April 24, 2024, 10:40:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Minor cosmetic change in total logged time.  (Read 270 times)
mdayonliner (OP)
Copper Member
Sr. Member
****
Offline Offline

Activity: 630
Merit: 420


We are Bitcoin!


View Profile
May 18, 2018, 07:36:10 PM
 #1

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

Be happy be at peace. Looking forward to BTC at $1M
1713955238
Hero Member
*
Offline Offline

Posts: 1713955238

View Profile Personal Message (Offline)

Ignore
1713955238
Reply with quote  #2

1713955238
Report to moderator
1713955238
Hero Member
*
Offline Offline

Posts: 1713955238

View Profile Personal Message (Offline)

Ignore
1713955238
Reply with quote  #2

1713955238
Report to moderator
1713955238
Hero Member
*
Offline Offline

Posts: 1713955238

View Profile Personal Message (Offline)

Ignore
1713955238
Reply with quote  #2

1713955238
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713955238
Hero Member
*
Offline Offline

Posts: 1713955238

View Profile Personal Message (Offline)

Ignore
1713955238
Reply with quote  #2

1713955238
Report to moderator
1713955238
Hero Member
*
Offline Offline

Posts: 1713955238

View Profile Personal Message (Offline)

Ignore
1713955238
Reply with quote  #2

1713955238
Report to moderator
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
May 19, 2018, 12:07:58 AM
 #2

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.
mdayonliner (OP)
Copper Member
Sr. Member
****
Offline Offline

Activity: 630
Merit: 420


We are Bitcoin!


View Profile
May 19, 2018, 01:15:47 PM
 #3

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.

Be happy be at peace. Looking forward to BTC at $1M
Tyrantt
Hero Member
*****
Offline Offline

Activity: 1022
Merit: 564

Need some spare btc for a new PC


View Profile
May 19, 2018, 01:25:20 PM
 #4

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.

Need some spare btc for a new PC that can at least run Adobe Dreamweaver.

BTC - 19qm3kH4MZELkefEb55HCe4Y5jgRRLCQmn ♦♦♦ ETH - 0xd71ACd8781d66393eBfc3Acd65B224e97Ae1952D
minifrij
Legendary
*
Offline Offline

Activity: 2324
Merit: 1267


In Memory of Zepher


View Profile WWW
May 19, 2018, 04:11:26 PM
 #5

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'], '<br />';

echo str_replace(array('1 days', '1 hours', '1 minutes'), array('1 day', '1 hour', '1 minute'), $timeString);
}
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
May 19, 2018, 04:24:08 PM
 #6

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'], '<br />';

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).
shahzadafzal
Copper Member
Legendary
*
Offline Offline

Activity: 1526
Merit: 2890



View Profile
May 19, 2018, 04:25:10 PM
 #7

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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
May 19, 2018, 04:31:00 PM
 #8

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
mdayonliner (OP)
Copper Member
Sr. Member
****
Offline Offline

Activity: 630
Merit: 420


We are Bitcoin!


View Profile
May 19, 2018, 09:08:55 PM
 #9

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.

Be happy be at peace. Looking forward to BTC at $1M
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
May 19, 2018, 09:30:50 PM
 #10

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.
minifrij
Legendary
*
Offline Offline

Activity: 2324
Merit: 1267


In Memory of Zepher


View Profile WWW
May 20, 2018, 01:22:53 AM
Merited by jackg (1)
 #11

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.
mdayonliner (OP)
Copper Member
Sr. Member
****
Offline Offline

Activity: 630
Merit: 420


We are Bitcoin!


View Profile
May 21, 2018, 01:26:01 PM
 #12

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.

Be happy be at peace. Looking forward to BTC at $1M
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
May 21, 2018, 04:22:47 PM
 #13

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.
mdayonliner (OP)
Copper Member
Sr. Member
****
Offline Offline

Activity: 630
Merit: 420


We are Bitcoin!


View Profile
May 21, 2018, 08:01:40 PM
 #14

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.

Be happy be at peace. Looking forward to BTC at $1M
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!