1 of 5
1
Expire Users with SCM Extension & Cron Job—Does this work?
Posted: 24 April 2008 07:51 PM   [ Ignore ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7268
Joined  05-07-2007

Hello,

I’m working on an online education site that will have a six month membership with an option to renew.  I REALLY don’t want to have to do it manually, as I am a part owner of the company.  So I came up with the following extension & php script to run as a cron job to try to do the trick.

I would appreciate it if people would be willing to look at this, tell me what they think & feel free to borrow if it would help them out.  However, I have a couple of concerns.  This method is completely depends on getting the ping back from Paypal and changing their member group.  I have read that it’s not always reliable (is this true?)

So a member who has not paid is in the default member group of ‘4’.  I will have their member group change to ‘7’ upon the ping from PayPal.  Do you think the page they are returned to after purchase could have a “success” message, or conditionals to see if they are still in member group ‘4’ and tell them there was a problem receiving info from paypal, and they should email us with their info.  Or is this unprofessional? 

Other admins will have access to SCM, but not Extensions, so I have this making a new table with the info I want, to help to protect from other Admins from “cleaning things up” and messing up the system.  That being said, I would love suggestions on how to get stuff into the DB without having to enter stuff manually.

Any and all suggestions/feedback is much appreciated.

Regards,

-greg

File Attachments
expireUsers.zip  (File Size: 5KB - Downloads: 407)
 Signature 

gregaker.net | Follow me on Twitter

Profile
MSG
 
 
Posted: 24 April 2008 08:02 PM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4277
Joined  12-06-2002
Greg A. - 24 April 2008 11:51 PM

This method is completely depends on getting the ping back from Paypal and changing their member group.  I have read that it’s not always reliable (is this true?)

Hi Greg -

I’m using SCM & member group changes on one of my own sites.  I’m interested in this extension for use there as well, so will find time to look at it over the next couple of days.

I’ve not yet had any issues with people paying through PP and not getting the ping back - and that’s with a few hundred instances.

 Signature 

Get the missing EE2 owner’s manual - a complete guide to building an EE2 site.  It’s available in PDF or print.

Profile
 
 
Posted: 24 April 2008 08:28 PM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7268
Joined  05-07-2007

Michael:

Thanks for the reply.  Looking over it again, I made a couple of changes and re-uploaded above.  I look forward to hearing what you have to say!  =)

Many Thanks!  grin

-greg

 Signature 

gregaker.net | Follow me on Twitter

Profile
MSG
 
 
Posted: 24 April 2008 08:54 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  329
Joined  03-16-2002

Sounds interesting. I’ll have a look as well as soon as time permits. Thus a feature could really be very useful in some cases.

Of course, every action handled by the SCM (or any shop automation using PayPal) will depend to the IPN PayPal sends as a pingback. My concern always was when having multiple courses/products - I only can change the member group tio the one associated with the last successful payment. But I’ll need to digg into your code over the weekend first to give some qualified comments.

Thanks for sharing!
Markus

Profile
 
 
Posted: 24 April 2008 10:16 PM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7268
Joined  05-07-2007

Markus:

For what it’s worth, at this time, we are only running one course, but in the next couple of years it could expand, so that’s something I definitely need to take into consideration.  Off the top of my head, maybe have different member groups, but also reference the id of the purchase in the db to give them permissions?  Oh wow, this could grow into a monster!  wink

If you care, I’m using code igniter to populate a dynamic flash-driven practice test, and I’m using standard EE weblog stuff to do the rest of the site with some custom modules & plugins.  I’m EXTREMEMLY excited that the 2.0 will be on top of CI, as I can’t wait to see how it will all integrate!  =)

I appreciate you checking this out, and look forward to comments! 

Regards,

-greg

 Signature 

gregaker.net | Follow me on Twitter

Profile
MSG
 
 
Posted: 28 April 2008 11:07 AM   [ Ignore ]   [ # 5 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4277
Joined  12-06-2002

OK - taking a couple minutes to look at this.

Keep in mind I’m not a PHP guy - so it’s likely I’m not fully understanding the code..wink

I think overall the approach looks promising for my needs - which are essentially just rolling back a person from a “customer” member group to a “member” member group if their last purchase date is older than a set amount of time.

However I’d want an interface where I could set/choose the member group ID’s, change the text of the emails that get sent, change the timeframe for the rollback etc.  I almost wonder if what I’m after is more of a module rather than an extension.

 Signature 

Get the missing EE2 owner’s manual - a complete guide to building an EE2 site.  It’s available in PDF or print.

Profile
 
 
Posted: 28 April 2008 11:13 AM   [ Ignore ]   [ # 6 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7268
Joined  05-07-2007

Michael,

Thanks for the response.

I am a PHP guy “wanna-be,” so I’m trying hard here.  wink

I have been thinking about this, and I am expanding to allow for different user groups to have different expiration times, etc.

I think this can be accomplished with settings on the extension & a plugin for the cron-job.

I will keep tinkering, probably ask some questions on the boards for the real “php guys & gals” and re-upload on this thread when I have something.

Kindest Regards,

-greg

 Signature 

gregaker.net | Follow me on Twitter

Profile
MSG
 
 
Posted: 17 September 2008 03:54 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Hi Greg, this looks to be a really interesting extension. On first inspection of the code my first thoughts are could this be achieved by just adding a custom member field for renewal date rather than adding a new table?

I’m sure there is a simple reason for having taken this approach but if you had the renewal date in a custom member field you could call it up on member pages so that a member could see when they renewed and you could also then display an expiry date. :?

Finally, perhaps I am being daft but which file do you call with the CRON job? Or are you using the EE Cron Plug-in? It would be great to see this develop into a module with an interface to show subscriptions, expiry dates etc for members.

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 17 September 2008 05:04 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Some more feedback for you Greg!

It looks as though this extension sets the ‘renewal_date’ for a returning (not new) member to ‘today’. Would it not make more sense to set the renewal date to the expiry date ‘if’ the renewal date has not yet passed? This would allow members to renew prior to membership expiring if they wished.

smile

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 28 October 2008 02:12 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  43
Joined  09-24-2008

Hi there
What’s the latest on this plugin please? It looks like it would be very useful for me…

Thanks
Matt

Profile
 
 
Posted: 28 October 2008 02:39 PM   [ Ignore ]   [ # 10 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7268
Joined  05-07-2007

Sorry,

I haven’t had the time to do much with it.  I might try to pick it back up sometime soon.  grin

-greg

 Signature 

gregaker.net | Follow me on Twitter

Profile
MSG
 
 
Posted: 15 November 2008 08:28 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Hi Greg, I’m about to pick this ext up and use it to try and implement expiry of membership on a site we are working on so I just wanted to check if you had any further updates for us. Could you also confirm where we should be placing the ‘expireUSers.php’ file? I’m assuming it should be a page template with PHP enabled which is called by a EE cron job?

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 25 November 2008 09:18 PM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7268
Joined  05-07-2007

Hey nathan,

Still haven’t had time to do anything with it.  smile  Anyhoo, my original plan, which to be honest, I didn’t test, was to put that in a template and run it with the cron plugin.

-ga

 Signature 

gregaker.net | Follow me on Twitter

Profile
MSG
 
 
Posted: 25 November 2008 09:30 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Thanks for the clarification Greg. I’ll give it a shot and let you know how I get on! smile

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 12 December 2008 07:02 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Well I’m right in the thick of using this script as a starting point, just thought I should point out that while the extension creates a table called ‘exp_paid_members’ the PHP in the actual extension tries to interact with a table called ‘exp_paid_users’ so I’ve had to update the table references in the PHP at this end to reflect that. I’m also setting the renew date in the exp_paid_members table to $today+31556926 (12 months) in my case and setting the renew date for already paid members to the previous renew date plus 12 months.

Will keep you updated…

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 12 December 2008 09:16 AM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Right, well I have a revised version of the Extension which I have written which now includes a control panel setting screen to allow you to specify the subscription period and also the member group that paid members are assigned to upon completing a transaction using the simple commerce module.

I think once I have the standalone template which will be triggered by a CRON job working as expected the next step would be to try and wrap that up into a plug-in that accompanies this extension. The only issue I can foresee at present would be that of the email body content.

Greg, if you are happy for me to share the revised extension here please do let me know and I’ll attach it to this post.

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 12 December 2008 09:34 AM   [ Ignore ]   [ # 16 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  13771
Joined  04-15-2006

Would love to see what you have created there Nathan just as I love learning from other peoples extensions an what-not wink

Here’s hoping Greg says yes grin

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

Profile
 
 
Posted: 12 December 2008 09:44 AM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  753
Joined  10-14-2005

Well I have the template script running too also now, it sends an email if your subscription is due up within the next 10 days and reverts your membership back to the default member group once the renewal date has passed.

Seems to be working a treat!

Greg… you here? wink

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile
 
 
Posted: 20 December 2008 11:54 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Rank
Total Posts:  50
Joined  11-23-2007

This is exactly what I am needing, any chance you will go ahead and release this. Or maybe you could just email me : )

Profile
 
 
   
1 of 5
1