Search code examples
phpwordpressdatemembership

MemberMouse Registration Date plus 24 hours


I am working on a MemberMouse subscription Wordpress website. On a specific user page, I need to display the time of the registration date plus 24 hours. For example, if registration date is: Jul 24, 2017 12:34 pm, I want to display: 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; ?>

By the way, the SmartTag "[MM_Member_Data name='registrationDate']" gives out for example: Jul 24, 2017 12:34 pm.

I tried above code to get registration date, but getting error.

Any solution to this problem would be appreciated.

Thanks,

Aron


Solution

  • The simplest code would look somewhat like this and keep your original idea of just processing the shortcode inline.

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

    However I would rather use the clean approach and do things seperately (plus: I got no idea what format the registrationDate shortcode is. Is that a unix timestamp or a string formatted 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; ?>