This modifies the database to create a rule, level and subscription to a certain set of posts. However, they currently are not actively subscribed, so they do not have access to those posts.
I can also dynamically adjust the rules in any way I want.
Temporary functionality (NOT WORKING)
1.) I currently have htaccess auth set to the root of the installation until the site goes live. I need to do paypal sandbox testing. What do I need to do for /paymentreturn/paypalexpress to be open to the public, so that Paypal does not get any errors?
Future functionality (NOT WORKING)
1.) I need to filter payment notification with a function. Upon successful payment received, modify a rule. What add_filter do I need to add for this to happen, and what variables do I have access to?
1.A.) I also need to change "level_price" to reflect the price they paid. I will also need to change level_period_unit depending upon whether or not it's yearly or monthly.
2.) I need to implement drip feeds, so that each post added to the rule takes 1 week before it becomes available. I would also like to print how long until the week has expired. How can I accomplish this?
This modifies the database to create a rule, level and subscription to a certain set of posts. However, they currently are not actively subscribed, so they do not have access to those posts.
I can also dynamically adjust the rules in any way I want.
Temporary functionality (NOT WORKING)
1.) I currently have htaccess auth set to the root of the installation until the site goes live. I need to do paypal sandbox testing. What do I need to do for /paymentreturn/paypalexpress to be open to the public, so that Paypal does not get any errors?
Future functionality (NOT WORKING)
1.) I need to filter payment notification with a function. Upon successful payment received, modify a rule. What add_filter do I need to add for this to happen, and what variables do I have access to?
1.A.) I also need to change "level_price" to reflect the price they paid. I will also need to change level_period_unit depending upon whether or not it's yearly or monthly.
2.) I need to implement drip feeds, so that each post added to the rule takes 1 week before it becomes available. I would also like to print how long until the week has expired. How can I accomplish this?
I'll answer one at a time so that i can have a little think and look at the code for each one in turn.
I need to filter payment notification with a function. Upon successful payment received, modify a rule. What add_filter do I need to add for this to happen, and what variables do I have access to?
I need to implement drip feeds, so that each post added to the rule takes 1 week before it becomes available. I would also like to print how long until the week has expired. How can I accomplish this?
Can you explain this one a bit more for me? Struggling to get my head around it, but it could be the lateness of the hour here.
Will that fire off my function? I do want the normal payment gateway stuff to work for sure (if it activates whatever subscription I send to it.) What if I need to access variables such as how much a user has paid or what user ID paid?
_____
Drip feeds release a post every x amount of days into a user's rule.
I'm thinking that the best way to do this is a cronjob on a single php file, which checks a MySQL job queue table. The following would occur:
MySQL table which has the following columns: Job ID, User ID, Post ID, Expiry Date
PHP file is run every 10 minutes which states:
For each Job in Job Queue Table, if today's date == expiry date, then update the rule with user_id and post_id.
Hi Barry! if I do an
add_filter('membership_handle_payment_return_paypalexpress', 'my_function', 11);
Will that fire off my function? I do want the normal payment gateway stuff to work for sure (if it activates whatever subscription I send to it.)
Change that to add_action - you only want to use add_filter if you are returning a value to the calling function (the bit that does do_action or apply_filters) and the payment part does do_action, so using a filter isn't needed.
Alternatively, if you are keeping the standard paypal gateway processing as well, then you can hook into: add_action('membership_payment_subscr_signup', 'my_function');
which passes the $user_id and $sub_id to it.
or add_action('membership_payment_processed', 'my_function');
which passes in the $user_id, $sub_id, $amount, $currency and PayPal transaction id.
What if I need to access variables such as how much a user has paid or what user ID paid?
Have a look at the code in the paypalexpress gateway, it will show how to get the amounts and user Id out of the returned paypal information - or hook into one of the calls above instead - the second of which passes in all the info.
Woah! Thank you. I will write some code today to see where I'm at.
Would, add_action('membership_payment_processed', 'my_function');
Work for 2CO or other gateways as well?
Do you know how I can bypass htaccess authorization for the paypal payment gateway? (I tried doing this in paymentreturn/, which is fine for static files, but not for the virtual ones like paypalexpress.)
10626 pointsLike some sort of WPMU DEV GodMindblowingly helpful memberLifetime member
Sales & Support Lead
—
30th March 2011 (1 year ago)
#
Hiya dseason,
I'm marking this particular one as resolved so that we can continue troubleshooting on the thread you've linked to above. If you need further clarification here, feel free to re-open.
Responses (7)
Developer — 9th March 2011 (1 year ago) #
I'll answer one at a time so that i can have a little think and look at the code for each one in turn.
add_action('membership_handle_payment_return_paypalexpress', 'custom_paypal_return');You may want to remove all actions from that hook first if you don't want the normal paypal gateway action to fire as well.
Developer — 9th March 2011 (1 year ago) #
Can you explain this one a bit more for me? Struggling to get my head around it, but it could be the lateness of the hour here.
Member — 9th March 2011 (1 year ago) #
Hi Barry! if I do an
add_filter('membership_handle_payment_return_paypalexpress', 'my_function', 11);Will that fire off my function? I do want the normal payment gateway stuff to work for sure (if it activates whatever subscription I send to it.) What if I need to access variables such as how much a user has paid or what user ID paid?
_____
Drip feeds release a post every x amount of days into a user's rule.
I'm thinking that the best way to do this is a cronjob on a single php file, which checks a MySQL job queue table. The following would occur:
MySQL table which has the following columns: Job ID, User ID, Post ID, Expiry Date
PHP file is run every 10 minutes which states:
For each Job in Job Queue Table, if today's date == expiry date, then update the rule with user_id and post_id.
Developer — 9th March 2011 (1 year ago) #
Change that to add_action - you only want to use add_filter if you are returning a value to the calling function (the bit that does do_action or apply_filters) and the payment part does do_action, so using a filter isn't needed.
Alternatively, if you are keeping the standard paypal gateway processing as well, then you can hook into:
add_action('membership_payment_subscr_signup', 'my_function');which passes the $user_id and $sub_id to it.
or
add_action('membership_payment_processed', 'my_function');which passes in the $user_id, $sub_id, $amount, $currency and PayPal transaction id.
Have a look at the code in the paypalexpress gateway, it will show how to get the amounts and user Id out of the returned paypal information - or hook into one of the calls above instead - the second of which passes in all the info.
Member — 9th March 2011 (1 year ago) #
Woah! Thank you. I will write some code today to see where I'm at.
Would,
add_action('membership_payment_processed', 'my_function');Work for 2CO or other gateways as well?
Do you know how I can bypass htaccess authorization for the paypal payment gateway? (I tried doing this in paymentreturn/, which is fine for static files, but not for the virtual ones like paypalexpress.)
Member — 16th March 2011 (1 year ago) #
Hi Barry,
It seems that the membership plugin isn't activating my user's subscription (see: http://premium.wpmudev.org/forums/topic/membership-functionality-iii-paypal-integration-and-ipn)
I suppose I could activate it in my add_action?
Sales & Support Lead — 30th March 2011 (1 year ago) #
Hiya dseason,
I'm marking this particular one as resolved so that we can continue troubleshooting on the thread you've linked to above. If you need further clarification here, feel free to re-open.
Thanks!
Become a member