Hooking Into The Membership Plugin

I'm looking to dynamically add a field or two to the purchase form for the membership plugin. For example, in addition to filling out the name and CC info I need to ask them what BuddyPress group is associated to the membership they are purchasing. I have the backend code for this already done, but I need hooks to:

- Ask them this question on the purchase form
- Ensure that I can hook after a successful purchase to associate the answer to that question as the user's confirmation screen appears.

Also - stupid question - but assuming there are hooks, where's the documentation for them? :slight_smile:

Thanks in advance.

  • Jack Kitterhing

    Hi there @dimensionmedia,

    Hope you're well today and thanks for your question.

    We'd normally recommend BuddyPress to add additional profile fields, in Membership 4.0, we're adding extra filters and functions to be able to easily extend membership.

    In the mean time in membership > classes > membership > render > page > registration > standard.php line 85 is where it starts the form, there may be some filters there you can use.

    All code is documented inline :slight_smile:


    Kind Regards

  • dimensionmedia


    Thanks for the fast response. Truly appreciate it. As much as i appreciate the tip and knowing some advancements are coming in 4.0, i'm a little disappointed on the lack of developer documentation currently.

    That being said i did take your advice and looked at the file. As i suspected, i don't see a problem adding the field i need for the signup form, but I would appreciate some tips on how to CARRY that information so that when a confirmation (successful) appears I can do what i need to do. Any chance the developer of plugin could chime in to offer the "best way" to do this with the current 3.5.x version?


  • Hoang Ngo

    Hi @dimensionmedia

    We are sorry for your issue.

    Currently now, in the version 3.5.1(our lastest), we dont have much hook for your need.

    So the only thing now, we should modify the form code, or adding your custom hook and fire it.

    The file for payment form is
    For the payment return, please look at the folder

    You can add your custom fields here, and when the form submit, we can firsly prevent it by javascript, and using ajax to update those field data to database, cookie, or websql (this cool from html5). Then we fire the payment form by js.

    After the payment done and it go to the success page, for now we can get the temp data we store previous and process it with the value return from the payment gateway.

    Depend on your payment gateway, i example it is paypal express, so in the file gateway.paypalexpress.php, there is a function call "handle_paypal_return" (every other file having this similiar function too), this is where you can process your custom data when payment done.

    Best Regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.