2018-10-28, 08:03 PM
I am attempting to add a return date to a custom page. However I've gone through several mishaps.
At first I had this which works IF the user had a return date set, otherwise instead of saying Unknown it would say Today (which is false).
So I replaced it with this but then EVERYTHING said Unknown, even if there was a return date set.
I ended up taking everything out to use MyBBs core coding found in member.php regarding returndates. However once again I am back to EVERYTHING saying Unknown.
I have also attempted to change $returnhome = explode("-", $memprofile['returndate']); to the following with no change to the Unknown display issue even if a date is added.
At first I had this which works IF the user had a return date set, otherwise instead of saying Unknown it would say Today (which is false).
$returndate = my_date($mybb->settings['dateformat'], strtotime($users['returndate']));
So I replaced it with this but then EVERYTHING said Unknown, even if there was a return date set.
$returndate = my_date($mybb->settings['dateformat'], strtotime($users['returndate']));
if(!$returndate) {
$returndate = "Unknown";
}
I ended up taking everything out to use MyBBs core coding found in member.php regarding returndates. However once again I am back to EVERYTHING saying Unknown.
if($memprofile['returndate'] == '')
{
$returndate = "$lang->unknown";
}
else
{
$returnhome = explode("-", $memprofile['returndate']);
// PHP native date functions use integers so timestamps for years after 2038 will not work
// Thus we use adodb_mktime
if($returnhome[2] >= 2038)
{
require_once MYBB_ROOT."inc/functions_time.php";
$returnmkdate = adodb_mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate, "", 1, true);
}
else
{
$returnmkdate = mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate);
}
}
I have also attempted to change $returnhome = explode("-", $memprofile['returndate']); to the following with no change to the Unknown display issue even if a date is added.
$returnhome = explode("-", $returndate);