Jump to content

Memberships and development approach


Rudy
 Share

Recommended Posts

Hi all,

I am currently building a custom membership functionality for a client. Here are the procedure:

User fills in a membership registration form. Based on the form data, it is supposed to do the following

  • create user, add roles (guest, subscriber OR free-trial)
  • if free-trial, remove/disable user after X number of days
  • if free-trial, add user to mailchimp list in the free-trial segment
  • if subscriber, add user to mailchimp list in the subscriber segment
  • if subscriber, create a new invoice via Freshbooks API and get Freshbooks to charge to user's credit card via Stripe

My questions:

  • What is the best approach on this? all in one module? or separate tasks into its own module?
  • Are there any existing module(s) that already do these things?

Thanks

Rudy

Link to comment
Share on other sites

I would say depends on your skills and preference.

You could code all the logic right into your template files
that's how I started, and still start some things until I figure the task get's more complicated and needs to be in a function or own class/module
stuffing all in template files feels faster in the beginning but can be a little harder to maintain depending on the complexity

Another thought, if you plan to trigger certain tasks from one point or can easily direct to one location (like setting all form action to one page) just put everything in templates
otherwise, or if there is enough evidence that you might add calls from other places, then maybe better split tasks in classes

I wouldn't put to many things in one module, for me it always got messy, so if you choose the modular way put mailchimp and freshbooks each in one module and maybe the user stuff in a separate and maybe split even user tasks in different modules if it makes sense you could even create a new page type e.g. "member" https://processwire.com/docs/tutorials/using-custom-page-types-in-processwire/ 

I don't think there are existing modules, that's because the tasks are fairly basic (create user, add role, remove user etc) and mailchimp/freshbooks depend on their own api's..

If you got more questions on this let us know

  • Like 2
Link to comment
Share on other sites

Actual i've to build a prototype with usermanagment and useractivity and for rapid prototyping the template way is not that bad...at least for me.

I use template files for routing to the different actions so all template files stay as clean as possible.

example:

---app_root (page for the app available under www.my-site.com/app/...
-----login_page (~50 lines code)
-----logout_page (~ 10 lines code)
-----register_page (~400 lines - two way auth...)

....

The separated code of the template could easy splitt in modules/classes later.

I using https://bitbucket.org/pwFoo/formhelper/

Regards mr-fan
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By prestoav
      Hi all,
      I've noticed that, when creating new users for clients, the chosen admin theme is not saved. For example, I create a new user select Reno or UIKit as the theme at point of creation and save. When logging in that user for the first time the admin theme is back to default. Changing it again and saving corrects this.

      Anyone else noticed this or is it a known bug at the moment?

      CMS V 3.0.156.

      Thanks!
    • By Greg Lumley
      Hi! I've just discovered Processwire and I'm absolutely loving how clean it is. Especially with the full control over what it outputs. 
      Excuse me if this is a really stupid question.
      What happens if a user wants to insert multiple images into the blog field? In other words Shift+Click all the images attached to a specific page in and insert. It seems I can insert one at a time but not multiple.

      Based on the above, I want to rebuild my website. I'm a photographer (ex php dev 2004) and plan also to target websites at other photographers. So inserting multiple images into blog posts is a key part. I'd like to output that to something like UIkit or some kind of Masonry Gallery script. Any thoughts would be fantastic please. 
      Thank you.
      Greg. 
      I'm an ex PHP developer now photographer, now thanks to Corona and not photo work, a rusty PHP developer 😁
    • By AndZyk
      Hello,
      this maybe a simple question, but it bothers me for a while now:
      There used to be a warning, if two or more user try to edit the same page. But ever since AdminThemeUIkit I haven't seen it any more.
      Is this a bug or are there special circumstances under which the warning will be displayed?
      If I am logged-in in the same browser with one default and one privat window, I don't see this warning. But also different browsers on different machines in the same network don't see this warning.
      I was looking for the blog post on which this feature was announced, but couldn't find it anymore.
      We had the case, that two people were writing a text for the same page, but after person A saved the page first, the text of the person B was lost. I know we could have used ProDrafts for this case, but it shouldn't happen in the first place.
      I would appreciate some feedback. 😀
      Regards, Andreas
    • By SwimToWin
      I have a website that allows users to create their personal "website" (a page with sub-pages).
      Users shall be able to:
      Log in (frontend and/or admin), Edit "their" page(s) - I am using the "Page Edit Per User"-module (https://modules.processwire.com/modules/page-edit-per-user/) to grant access to the relevant pages Create child pages - possible? Users shall not be able to see other pages in the admin interface - "Admin Restrict Page Tree" may do the trick (https://modules.processwire.com/modules/admin-restrict-page-tree/)? Frontend editing shall be possible - I am considering "Fredi" (https://modules.processwire.com/modules/fredi/) for this. The challenge is that it takes a lot of modules and configuration.
      Is there a way to set this up that doesn't require a lot of configuration for each new user?
    • By quickjeff
      Hey guys, 
      Looking for another dev to help on multiple processwire projects as well as some other PHP apps. 
      First project is a directory style site with lots of components to come, including stripe implementation  and other fun stuff.
      Need someone ASAP to help out. 
       
      Thanks.
×
×
  • Create New...