[For 1.8] Less than 1 minute ago > % second(s) ago
#11
Isn't this already apart of 1.8?
Coming soon..
Reply
#12
(2015-10-08, 06:58 PM)JonathanP Wrote: Isn't this already apart of 1.8?

Nope, it shows Less than 1 minute ago instead of seconds ago.
Reply
#13
This user has been denied support. This user has been denied support.
Doesnt work. Page goes white
If I help please +1 me!

VorkinPride Owner
The all in on forum site


Reply
#14
Looks like ATofighi made a ninja edit to the code. Try it out again guys.
PGP Key (Fingerprint: 23B6 F4C0 FE2D 45AA 61A0 1E86 DB87 09DC DD87 6E40)
Reply
#15
Works now, thanks Smile
-Ben

Please do not PM me for support. I am looking to be hired for paid services.

You can view my paid services here.
Reply
#16
If you are not a fan of core edits you can get the same functionality using the "my_date" hook.
[Image: axolis.png]

Project, Portfolio and Product management for freelancers.
Reply
#17
Couldn't help it but [Image: f36714969252cfd2726bbf48e863caae.png]
Reply
#18
Nice theread
Reply
#19
if($diff <= 60)
{
    // seconds ago
    if($diff == 1) {
        return $diff . ' second ago';
    }
   else {
    return $diff . ' seconds ago';
   }
} 
thats works fine
but how to change the language of the seconds ago
Reply
#20
Thanks to the OP for this nice nifty suggestion! +1!

(2015-10-08, 06:58 PM)JonathanP Wrote: Isn't this already apart of 1.8?
As per 1.8.7, not yet.

(2016-08-24, 04:20 PM)Michael_vx Wrote: ...but how to change the language of the seconds ago
The fact it was done in a non-localized manner might be one of the reasons why this modification has not been added to MyBB yet.
Another reason might be that this modification has more errors. For example, the premature returning can break plugins.

Thus I believe the proper way to do this modification would look more like the following:

In the code section the OP mentioned, replace the line
	$relative['prefix'] = $lang->rel_less_than;
(or, if present, the code of the OP) with this line:
        $date = ' ' . (($diff <= 1) ? $lang->rel_seconds_single : $lang->rel_seconds_plural) . ' ago';
In the file inc/languages/english add these two lines
$l['rel_seconds_single'] = "second";
$l['rel_seconds_plural'] = "seconds";
at about line 348.
If you use language packs, you have to add the according entries there respectively.

I think I'll have to make a pull request soon to get this modification included in a later version of MyBB.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)