php
  • wordpress
  • date
  • membership
  • 2017-07-28 115 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; ?> 
    
    相關問題