Quote from: Kindred on January 27, 2021, 03:24:47 PMYou want *ALL* dates to be relative?
Instead of doing the Subs.php and modifications.english.php edits that this mod originally suggested...
comment out or delete these lines.// Today and Yesterday?
if ($modSettings['todayMod'] >= 1 && $show_today === true)
{
// Get the current time.
$nowtime = forum_time();
$then = @getdate($time);
$now = @getdate($nowtime);
// Try to make something of a time format string...
$s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
{
$h = strpos($user_info['time_format'], '%l') === false ? '%I' : '%l';
$today_fmt = $h . ':%M' . $s . ' %p';
}
else
$today_fmt = '%H:%M' . $s;
// Same day of the year, same year.... Today!
if ($then['yday'] == $now['yday'] && $then['year'] == $now['year'])
return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);
// Day-of-year is one less and same year, or it's the first of the year and that's the last of the year...
if ($modSettings['todayMod'] == '2' && (($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year']) || ($now['yday'] == 0 && $then['year'] == $now['year'] - 1) && $then['mon'] == 12 && $then['mday'] == 31))
return $txt['yesterday'] . timeformat($log_time, $today_fmt, $offset_type);
}$nowtime = forum_time();
$retVal = time_ago($nowtime, $time);
return $retVal;function time_ago($now, $then)
{
global $txt;
if(!is_numeric($then))
$then = strtotime($then);
$periods_sing = array($txt['rel_second'], $txt['rel_minute'], $txt['rel_hour'], $txt['rel_day'], $txt['rel_week'], $txt['rel_month'], $txt['rel_year'], $txt['rel_age']);
$periods_plur = array($txt['rel_seconds'], $txt['rel_minutes'], $txt['rel_hours'], $txt['rel_days'], $txt['rel_weeks'], $txt['rel_months'], $txt['rel_years'], $txt['rel_ages']);
$lengths = array("60","60","24","7","4.35","12","100");
$difference = $now - $then;
if ($difference <= 10 && $difference >= 0)
return $tense = $txt['just_now'];
elseif($difference > 0)
$tense = $txt['ago'];
elseif($difference < 0)
$tense = $txt['later'];
for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
$difference /= $lengths[$j];
}
$difference = round($difference);
if ($difference > 1)
$period = $periods_plur[$j];
else
$period = $periods_sing[$j];
return "{$difference} {$period} {$tense} ";
}
$txt['just_now'] = 'just now';
$txt['ago'] = 'ago';
$txt['later'] = 'later';
$txt['rel_second'] = 'second';
$txt['rel_minute'] = 'minute';
$txt['rel_hour'] = 'hour';
$txt['rel_day'] = 'day';
$txt['rel_week'] = 'week';
$txt['rel_month'] = 'month';
$txt['rel_year'] = 'year';
$txt['rel_age'] = 'age';
$txt['rel_seconds'] = 'seconds';
$txt['rel_minutes'] = 'minutes';
$txt['rel_hours'] = 'hours';
$txt['rel_days'] = 'days';
$txt['rel_weeks'] = 'weeks';
$txt['rel_months'] = 'months';
$txt['rel_years'] = 'years';
$txt['rel_ages'] = 'ages';
$txt['relative_today'] = 'All times are Relative';
(Edit -- do note that my code changes above will install the relative dates/times REGARDLESS of the setting in the admin. The code I put together was a hack to REPLACE, not add an option, to the current code)
Quote from: suxatcoding on December 06, 2023, 10:13:04 PMThanks. I forgot to mention that I only want short previews accessible to the public. I need the full videos accessible to paying members only because the cost involved are too much to make them accessible to everyone.
Quote from: TwitchisMental on December 05, 2023, 06:15:04 PMHey just noticed that I get this error every so often.
/forum/Themes/default/RecentTopicsBoardIndex.template.php (Line 88)
Backtrace information
Type of error: General
Error message Select
2: foreach() argument must be of type array|object, null given
&2: Undefined array key "categories"
Undefined array key "ip"
Backtrace information see attach.SFS Failed as no data was sent:https://api.stopforumspam.org/api?json¬orexit&expire=90
Backtrace information see attach.[youtube]https://youtu.be/LLcdqyDv2-s?si=vnEVS8ETZ37g8L2y[/youtube]