Advertisement
Guest User

Untitled

a guest
Feb 20th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. Re: MemberProfiles Module playing nice with the SwipeStripe Ecommerce Module Link to this post
  2.  
  3. 11 January 2013 at 2:45am Last edited: 11 January 2013 2:49am
  4.  
  5. In case somebody else comes this way, I believe I managed to achieve the outcome you were after by grabbing the neat and lightweight registration module from Aram at SS bits: http://www.ssbits.com/tutorials/2010/site-members-registering-users-and-allowing-them-to-edit-their-details/. The trick is to create a Customer and associate it with the customers group rather than leaving it as a simple Member.
  6.  
  7. So after downloading and installing the Registration and SwipeStripe modules in the usual way, I modified the doRegister method in RegistrationPage_Controller by commenting out the original Member creation code and replacing it with the necessary lines from ProcessOrder of the CheckoutPage_Controller in the SwipeStripe module:
  8.  
  9. /** -- Original implementation by Aram
  10. //Otherwise create new member and log them in
  11. $Member = new Member();
  12. $form->saveInto($Member);
  13. $Member->write();
  14. $Member->login();
  15.  
  16. //Find or create the 'user' group
  17. if(!$userGroup = DataObject::get_one('Group', "Code = 'users'"))
  18. {
  19. $userGroup = new Group();
  20. $userGroup->Code = "users";
  21. $userGroup->Title = "Users";
  22. $userGroup->Write();
  23. $userGroup->Members()->add($Member);
  24. }
  25. //Add member to user group
  26. $userGroup->Members()->add($Member);
  27. **/
  28.  
  29. // New implementation taken from SwipeStripe
  30. $member = new Customer();
  31. $form->saveInto($member);
  32. $member->write();
  33. $member->addToGroupByCode('customers');
  34. $member->logIn();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement