Page 1 of 1

Drip Feeding Periods

PostPosted: October 26th, 2010, 11:47 am
by KirkWard
Is there a way to measure the drip feeding period by anything other than days?

If I am charging my members by the month, or any other PayPal increment, it would make sense to have the drip feed periods match the subscription periods.

Thanks once again

Re: Drip Feeding Periods

PostPosted: October 27th, 2010, 4:03 am
by Jason Caldwell
Hi Kirk. Thanks for the great question.

There are two Constants available for Content Dripping:
Code: Select all
S2MEMBER_CURRENT_USER_REGISTRATION_TIME
S2MEMBER_CURRENT_USER_REGISTRATION_DAYS

S2MEMBER_CURRENT_USER_REGISTRATION_TIME
This will always be an integer; in the form of a Unix timestamp. 0 if not logged in. This holds the recorded time at which the Member originally registered their Username for access to your site. This is useful if you want to drip content over an extended period of time, based on how long someone has been a Member.
Code: Select all
<?php echo S2MEMBER_CURRENT_USER_REGISTRATION_TIME; ?>
This may output something like: 1270537981
( this is a Unix timestamp, which is based on seconds )

S2MEMBER_CURRENT_USER_REGISTRATION_DAYS
This will always be an integer. 0 if not logged in. This is the number of days that have passed since the Member originally registered their Username for access to your site. This is useful if you want to drip content over an extended period of time, based on how long someone has been a Member.
Code: Select all
<?php echo S2MEMBER_CURRENT_USER_REGISTRATION_DAYS; ?>
This may output something like: 120 ( 120 days is approx 4 months )

Using MONTH calculations -----------------------------------------------------------------------
Code: Select all
<?php if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER){ ?>

    This is some content that will be displayed to all Members.
    
    <?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30 >= 1){ ?>
        Drip content to Members who are at least 1 month old.
    <?php } ?>
    
    <?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30 >= 2){ ?>
        Drip content to Members who are at least 2 months old.
    <?php } ?>
    
    <?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30 >= 3){ ?>
        Drip content to Members who are at least 3 months old.
    <?php } ?>

<?php } ?>
So we are just calculating months dynamically; by dividing DAYS by 30.
Assuming there are 30 days ( on average ) in each month.

Re: Drip Feeding Periods

PostPosted: October 27th, 2010, 7:19 am
by KirkWard
Presuming I write a routine to calculate the "month days" (using a SUM from a routine similar to the EOM function in Excel), I presume this formula would have no problem accepting a variable?

Or, using 30.5 days, since 365/12 approx 30.5?

Re: Drip Feeding Periods

PostPosted: October 27th, 2010, 7:47 am
by Jason Caldwell
KirkWard wrote:Presuming I write a routine to calculate the "month days" (using a SUM from a routine similar to the EOM function in Excel), I presume this formula would have no problem accepting a variable?

Or, using 30.5 days, since 365/12 approx 30.5?

Yes, either of those concepts would be fine to use.

Code: Select all
    <?php if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER){ ?>

        This is some content that will be displayed to all Members.
        
        <?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30.5 >= 1){ ?>
            Drip content to Members who are at least 1 month old.
        <?php } ?>
        
        <?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30.5 >= 2){ ?>
            Drip content to Members who are at least 2 months old.
        <?php } ?>
        
        <?php if(S2MEMBER_CURRENT_USER_REGISTRATION_DAYS/30.5 >= 3){ ?>
            Drip content to Members who are at least 3 months old.
        <?php } ?>

    <?php } ?>