php
  • wordpress
  • date
  • membership
  • 2017-07-28 72 views 0 likes 
    0

    我正在MemberMouse订阅Wordpress网站上工作。在特定的用户页面上,我需要显示注册日期的时间加上24小时。例如,如果注册日期是:2017年7月24日12:34 pm,我想显示:2017年7月25日下午12点34分。MemberMouse注册日期加24小时

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

    顺便说,该智能标志 “[MM_Member_Data 名= 'registrationDate']” 给出例如:2017年7月24日下午12点34分。

    我试着上面的代码来获取注册日期,但得到错误。

    任何解决这个问题的方法将不胜感激。

    感谢,

    阿隆

    +0

    难道你不能只使用'[MM_Member_Data name ='expirationDate']'? – cmorrissey

    +0

    也有一个支持领域,他们可以帮助你http://support.membermouse.com/support/discussions – cmorrissey

    +0

    该标签只会返回注册日期,但我想在注册日期添加24小时。有没有可能? – Aron

    回答

    0

    最简单的代码看起来有点像这样,保持你原来只是处理简码在线的想法。

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

    但是我宁愿使用清洁的方法和做事seperately(加:我不知道该registrationDate简码是什么格式是Unix时间戳或字符串格式化的日期/时间?)

    <?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; ?> 
    
    相关问题