MemberMouse 注册日期加上 24 小时

MemberMouse Registration Date plus 24 hours

我正在开发 MemberMouse 订阅 Wordpress 网站。在特定的用户页面上,我需要显示注册日期加上 24 小时的时间。比如注册日期是:Jul 24, 2017 12:34 pm,我要显示:Jul 25, 2017 12:34 pm.

<?php
$datee= date("F j, Y g:i a", strtotime("[MM_Member_Data 
name='registrationDate']+ 10 hours"));
?>

Access until: <?php  echo $datee; ?>

顺便说一句,SmartTag“[MM_Member_Data name='registrationDate']" 给出例如:Jul 24, 2017 12:34 pm.

我尝试使用上面的代码获取注册日期,但出现错误。

如能解决此问题,我们将不胜感激。

谢谢,

阿隆

最简单的代码看起来有点像这样,并保持您最初的想法,即仅内联处理短代码。

<?php
$datee= date("F j, Y g:i a", strtotime(do_shortcode("[MM_Member_Data name='registrationDate'] + 10 hours")));
?>

Access until: <?php echo $datee; ?>

但是我宁愿使用干净的方法并单独做事(另外:我不知道 registrationDate 简码是什么格式。是 unix 时间戳还是格式为 date/time 的字符串?)

<?php
// let's assume for a minute that $registrationDate will be a php date aka unix timestamp
// if it's not, you'll have to first run this through strtotime again, i.e.:
// $registrationDate = strtotime(do_shortcode("[MM_Member_Data name='registrationDate']"));

$registrationDate = do_shortcode("[MM_Member_Data name='registrationDate']");
$datee = date("F j, Y g:i a", $registrationDate + 36000);
?>

Access until: <?php echo $datee; ?>