PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Help! How to show membership registration & expiry date?

s2Member Plugin. A Membership plugin for WordPress®.

Help! How to show membership registration & expiry date?

Postby candy » September 3rd, 2011, 7:38 am

Hi,

I have searched around but could not find anything that fits :-(

I want to make a page where the user will see the details about his membership.

Registration date, next due renewal date, cancelation button (to be deactivated 14 days before next due renewal date - like if he did not cancel at least 14 days in advance, renewal will go on)

I only found this: <?php echo S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME; ?>

but this gives the unix stamp and I want to show the normal readable date not the unix stamp! And have no clue how to do it :-(

Thanks!
User avatar
candy
Registered User
Registered User
 
Posts: 102
Joined: November 16, 2010

Re: Help! How to show membership registration & expiry date?

Postby Cristián Lávaque » September 3rd, 2011, 1:20 pm

You can work with the timestamp using PHP's time/date functions, like date(). http://php.net/date

For the EOT, this may help:

Code: Select all
$eot_time get_user_field('s2member_auto_eot_time'$user_id); 


If you need something more advanced, you could use the Notifications API to create your own logs and use those to display your messages.

We're working on improving this in future releases.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Help! How to show membership registration & expiry date?

Postby candy » September 4th, 2011, 8:18 am

Hi,

No way to get that, sorry :-(
Browsed through all that php jungle, all they talk about is how to convert a date in unix stamp, whereas I need exactely the opposite! And as I am not a programmer, most of that stuff is chinese for me anyways ...

Really, is there NO way to show people when their membership expires?
I think this is bad and many might feel cheated or so, give them the feeling we are hiding something, and that's definitely NOT what I want ...

I tried with <?php $eot_time = get_user_field('s2member_auto_eot_time', $user_id); ?> too ... but it does not show anything !??!
blank!??!

Help! This might be also legally a problem, if people have no way to clearly see when their membership expires or when next payment is due ...

Thanks!
User avatar
candy
Registered User
Registered User
 
Posts: 102
Joined: November 16, 2010

Re: Help! How to show membership registration & expiry date?

Postby camillemm » September 4th, 2011, 11:26 am

Code: Select all
<?php if (function_exists('$s2member_auto_eot_time')){$s2member_auto_eot_time = $s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time");} ?>
<?php
echo date("j F Y", $s2member_auto_eot_time);
?>


You should search in this forum as it has been explained how to do that (before complaining).
User avatar
camillemm
Registered User
Registered User
 
Posts: 86
Joined: September 7, 2010

Re: Help! How to show membership registration & expiry date?

Postby Cristián Lávaque » September 5th, 2011, 12:09 am

Candy, this thread may have info you can use for this: viewtopic.php?f=4&t=6196

Here's a code example:

Code: Select all
if ($days get_user_option('s2member_auto_eot_time'))
{
    
$days ceil(($days time()) / 86400);

    if (
$days 1)
        echo 
'Your subscription has expired.';
    elseif (
$days == 1)
        echo 
'Your subscription will end tomorrow!';
    else
        echo 
'You have '$days' days left.';


Note that those with a subscription don't have an EOT time until they stop the subscription in some way (e.g. cancelled).

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Help! How to show membership registration & expiry date?

Postby Cristián Lávaque » September 5th, 2011, 12:13 am

camillemm wrote:
Code: Select all
<?php if (function_exists('$s2member_auto_eot_time')){$s2member_auto_eot_time = $s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time");} ?>
<?php
echo date("j F Y", $s2member_auto_eot_time);
?>


Thanks a lot for the date() example! http://php.net/date

One correction: $s2member_auto_eot_time is a variable, not a function, and the value of that variable won't be a function either, so that will always be false. In the example above I used an if that I believe is close to what you wanted to show.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Help! How to show membership registration & expiry date?

Postby zauber » November 21st, 2011, 1:18 pm

Thanks, Cristián. There is something funky in that code, I think, but since only members in good standing will see the EOT for me, I could take out the conditional and it works fine. I threw it into my functions.php file as a new shortcode--seems like it would definitely be a nice thing to include as a default shortcode...
User avatar
zauber
Registered User
Registered User
 
Posts: 4
Joined: November 20, 2011

Re: Help! How to show membership registration & expiry date?

Postby raygulick » November 21st, 2011, 6:10 pm

Code: Select all
if (function_exists('$s2member_auto_eot_time')){$s2member_auto_eot_time = $s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time");} ?>
<?php
   echo '<p><em>Membership expires ';
   echo date("F j, Y", $s2member_auto_eot_time);
   echo '</em></p>';

This is a slight modification to the code shown above, but all it returns is the following, no matter what date the EOT is set at:
Membership expires January 1, 1970

Am I missing something obvious?
User avatar
raygulick
Registered User
Registered User
 
Posts: 18
Joined: November 9, 2011

Re: Help! How to show membership registration & expiry date?

Postby zauber » November 21st, 2011, 7:24 pm

As I said, I don't really need it, but I think (untested!) this should work:

Code: Select all
if ($s2member_auto_eot_time = get_user_field ("s2member_auto_eot_time") ) {
   echo '<p><em>Membership expires ';
   echo date("F j, Y", $s2member_auto_eot_time);
   echo '</em></p>';
}


That is, if the assignment succeeds, the assignment evaluates as true. Again, not really coder, so take it with a huge chunk of salt.
User avatar
zauber
Registered User
Registered User
 
Posts: 4
Joined: November 20, 2011

Re: Help! How to show membership registration & expiry date?

Postby raygulick » November 21st, 2011, 7:29 pm

OK. That shows the actual EOT date; much better, thanks!
User avatar
raygulick
Registered User
Registered User
 
Posts: 18
Joined: November 9, 2011

Re: Help! How to show membership registration & expiry date?

Postby raygulick » November 21st, 2011, 8:19 pm

This displays expiration date for members who have been manually added, with the EOT manually specified, but how would I show expiration date for members who have registered in the system, and therefore have no value for s2member_auto_eot_time? Is there another field I should be looking for?
User avatar
raygulick
Registered User
Registered User
 
Posts: 18
Joined: November 9, 2011

Re: Help! How to show membership registration & expiry date?

Postby Cristián Lávaque » November 25th, 2011, 11:24 pm

The thing is that users that have a subscription don't get an EOT time until the subscription stops for some reason. This will improve in the future.

You could probably work with the payment time and based on that, determine when he should be paying next. Like, if he started paying on a day 23rd of the month, then you can assume he pays every 23rd if it's a montly subscription. You can find the payment times mentioned under WP Admin -> s2Member -> API / Scripting -> s2Member Content Dripping.

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron