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™

Dripping By Member Level

s2Member Plugin. A Membership plugin for WordPress®.

Dripping By Member Level

Postby KirkWard » October 27th, 2010, 4:06 pm

As I have found that the method s2 discusses for "drip" content, principally refers to "dripping" from the users original registration date, with one exception, Jason's tip at viewtopic.php?f=4&t=602#p2620 led me to wondering if his solution could be used to solve the problem of tracking multiple levels of "drip" content.

First caveat, I am NOT a coder, I just copy and paste, and pjay with ideas I get from those who can. To wit, I came up with the following thoughts,, and am wondering if this can be used to create and store the variables needed to track multiple levels of "drip" content. Please let me know if it is on the right track, and if you iz a coder, please help with a finished product.
Putting the information into Wordpress ...

Level 1 Button

Code: Select all
[s2Member-PayPal-Button ... custom="www.example.com|TIMESTAMP|%cv2%|%cv3%|%cv4%" /]


Level 2 Button

Code: Select all
[s2Member-PayPal-Button ... custom="www.example.com|%cv1%|TIMESTAMP|%cv3%|%cv4%" /]


Level 3 Button

Code: Select all
[s2Member-PayPal-Button ... custom="www.example.com|%cv1%|%cv2%|TIMESTAMP|%cv4%" /]


Level 4 Button

Code: Select all
[s2Member-PayPal-Button ... custom="www.example.com|%cv1%|%cv2%|%cv3%|TIMESTAMP" /]



Getting the information from Wordpress ...

Code: Select all
$custom = get_user_option("s2member_custom");
list($domain, $timestamp1, $timestamp2, $timestamp3, $timestamp4) = preg_split("/\|/", $custom);

if (($timestamp4 == "") && ($timestamp3 == "") && ($timestamp2 == ""))
     { echo $timestamp1;}

   elseif (($timestamp4 == "") && ($timestamp3 == ""))
     { echo $timestamp1;
       echo $timestamp2;}

   elseif ($timestamp4 == "")
     { echo $timestamp1;
       echo $timestamp2;
       echo $timestamp3;}

   else
     { echo $timestamp1;
       echo $timestamp2;
       echo $timestamp3;
       echo $timestamp4;}
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010

Re: Dripping By Member Level

Postby Jason Caldwell » October 27th, 2010, 11:52 pm

Hi Kirk. Thanks for the great question. I don't really see anything wrong with this, except to say it appears to be a little convoluted to me. Here's how I might go about this; and I would try to keep your pipe delimited list of "custom" variables to a standard that is easy to follow ~ leaving plenty of room for you to get more elaborate in the future, in case you need to add something else.

Code: Select all
[s2Member-PayPal-Button ... custom="www.example.com|<?php echo time(); ?>" /]
You will need the Exec-PHP plugin installed for this to work inside a Post or Page.

Code: Select all
$custom = get_user_option("s2member_custom");
list(
$domain, $timestamp) = preg_split("/\|/", $custom);
$level = ws_plugin__s2member_user_access_level();
echo $timestamp; // A Unix timestamp.
echo $level; // Numeric Level number.          
* Note the use of `ws_plugin__s2member_user_access_level()`, which is built into the s2Member plugin; so you don't need to use a custom variable for that part.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Dripping By Member Level

Postby KirkWard » October 28th, 2010, 10:44 am

Hi Jason,

Thanks for the review and feedback, but I am wondering if you missed what I was trying to do.

What I am concerned about is keeping each lower level on the product release schedule it was already on when a member upgrades to a new level. By reserving the first 4 CVs after the URL as individual timestamps for each level, I can maintain track of the enrollment period at each level.

That way, if I set a script to release content every thirty days of a membership, a user will not revert to the first issue when they start a new level. I created a CV pipe for each button in a standard layout to do that.

In another thread, you stated that s2 did not have a way to keep track of each level independently. That is why I created a different different button for each level, as I don't see that your code provides a place to record the start date for each level.

That is why I have ...
%cv1% = start date for level 1
%cv2% = start date for level 2
%cv3% = start date for level 3
%cv4% = start date for level 4

and, why I think the php to extract this information would more likely be ...
Code: Select all
$custom = get_user_option("s2member_custom");
list($domain, $timestamp1, $timestamp2, $timestamp3, $timestamp4) = preg_split("/\|/", $custom);
$level = ws_plugin__s2member_user_access_level();
echo $timestamp1;
echo $timestamp2;
echo $timestamp3;
echo $timestamp4;
echo $level;      // Is this the current level only?
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010

Re: Dripping By Member Level

Postby Jason Caldwell » October 29th, 2010, 3:12 am

What I am concerned about is keeping each lower level on the product release schedule it was already on when a member upgrades to a new level.
Gotchya. I think this might be a better way to deal with this: viewtopic.php?f=4&t=1091#p4382

$level = ws_plugin__s2member_user_access_level();
echo $level; // Is this the current level only?

Yes, that is a representation of the current Membership Access Level. This will always be an integer. Possible values include: -1 through positive 4. -1 if not logged in. 0 if logged in as a Free Subscriber.

That way, if I set a script to release content every thirty days of a membership, a user will not revert to the first issue when they start a new level. I created a CV pipe for each button in a standard layout to do that.

I'm not sure I understand completely, but I should warn you that the "custom" field is modified by s2Member's IPN processor after a successful Subscription Modification. In other words, the "custom" value is always updated to the one reflected by the PayPal Button that a Customer uses to initiate a new Subscription, and/or a Subscription Modification. So this might not work in your case.

As stated above, I think you'll have better luck handling it this way:
viewtopic.php?f=4&t=1091#p4382

Otherwise, another possibility is for you to maintain your own internal user fields by Hooking into s2Member's IPN processing routines. There are MANY Hooks/Filters available through s2Member's IPN processing routines, inside this file: /s2member/includes/functions/separates/paypal-notify.inc.php
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Dripping By Member Level

Postby KirkWard » October 29th, 2010, 7:13 am

Thanks Jason,

I missed reading about the meta boxes. Combining those with the script example you gave looks like something I can understand. I don't understand what hooks are and am lost when it comes to using filters, so that script may be the way to go.

Thanks again.
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010

Re: Dripping By Member Level

Postby KirkWard » October 29th, 2010, 1:40 pm

In other words, the "custom" value is always updated to the one reflected by the PayPal Button that a Customer uses to initiate a new Subscription, and/or a Subscription Modification.

That is why I suggest reserving the next four spaces for CV1,2,3 & 4, then they will be in the correct position each time PayPal returns the IPN, no matter which level they are in, and the explode routine will allow me to determine what the timestamp is for each level, equal to or less than the current level.

The model I would use is that instead of merely reserving the first position for the domain name as you have, I would reserve five and use them as described below (See post viewtopic.php?f=4&t=1110#p4320 for the "if-then" routine used to evaluate the timestamps).
Code: Select all
$custom = get_user_option("s2member_custom");
list($domain, $timestamp1, $timestamp2, $timestamp3, $timestamp4) = preg_split("/\|/", $custom);

If a timestamp slot is empty, then there has been no enrollment at that level and there is nothing to age at that level. And, as you say, I am left with an unlimited number of positions (after those first five). By reserving the first five positions for the domain and four timestamps, I have a standard model that will not be broken by PayPal, only by me if I fail to follow that model.

That help clarify any? Think it will work?
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron