Where can I find the Membership plugin API documentation?

Hi,
I need to connect my site to an external payment system on an existing website.
I saw there's an API for the membership plugin.
Where can I find the documentation for these API?
Thanks,
Yonatan

  • Jack Kitterhing
    • Code Norris

    Hi there @Yonatan Kra

    Hope your well today and thanks for your question.

    All documentation for the code is inline within comments in the gateway files, you could check in membership > membership includes > and check the gateways there, for example PayPal express would most likely be the best one to check.

    And of course if there's anything I can help with please don't hesitate to ask :slight_smile:

    Thanks!

    Kind Regards
    Jack.

  • Yonatan Kra
    • Site Builder, Child of Zeus

    Hi,
    It's hard to find what I want inside all this code.
    I'll tell you the full story so you could help me better:
    I have a membership website in Joomla. I want to create a wordpress website with some features that will be available for the joomla members.
    Hence, I need that every time a member purchases a membership in the Joomla website, a membership will be created/funded for him in the wordpress website.
    In addition, when a membership expires in Joomla, I would like the user's membership to be expired in wordpress as well...
    I can ping a web page once a transaction happens or upon change of membership status in the Joomla website (so I guess it would need to be a web page on the wordpress site).
    How do you suggest I'll go about it?
    Thanks,
    Yonatan

  • Jack Kitterhing
    • Code Norris

    Hi there Yonatan,

    Hope your well today and thanks for the additional information, thanks for the explanation.

    We do have a ping feature, so would it be possible to send a POST or GET URL to the required information on the Joomla website?

    I'm going to include the lead developer here also @Eugene Manuilov

    Thanks!

    Kind Regards
    Jack.

  • Eugene Manuilov
    • Syntax Hero

    Unfortunately, the plugin doesn't have open API right now. It means that there is no way to do what you need. The only way to make it working with Joomla is to write such API which will allow you to cooperate both CMS. So you need to learn how membership plugin works and write your own plugin which will provide open API which your Joomla site will be able to use.

  • Yonatan Kra
    • Site Builder, Child of Zeus

    Ok.
    So as far as I can see it, there are 2 options to go at this:
    1) Is there a way to give a trial period for new members (like - create a subscription in paypal, pay 0 today and 50$/month after 30 days)?
    2) How do I create a plugin for the plugin?
    Here's what I found:

    $member = new M_Membership($user_id);
    		if($member) {
    			$member->create_subscription($sub_id, $this->gateway);
    		}
    
    		do_action('membership_payment_subscr_signup', $user_id, $sub_id);

    Is this the way to use it?
    Can I do it from anywhere inside wordpress (i.e. even from shortcode php exec)?
    So "$sub_id" is the id of the subscription set in the admin panel, and the gateway is just a string of the gateway name?
    Also - does the "do_action" links the membership to the user who's userid=$user_id?
    It seems like the same action being done twice. Can I just use the "do_action"? If there was a documentation for this, it would have been very helpful (I wanted to use the Joomla component, because it has GREAT documentation - you can check it out here:
    http://www.jpayplans.com/payplans/documentation/item/payplans-api.html
    Got anything like this? Cause right now, I need to guess...
    Thanks,
    Yonatan

  • Yonatan Kra
    • Site Builder, Child of Zeus

    Yes I have.
    It was about 2 years ago, so I appreciate shortcuts as much as possible.
    The API in the Joomla component is documented to such level that without knowing Joomla you can create a plugin for the component.
    That's what I'm missing here - some explanations of how to call functions and what functions do.

  • Eugene Manuilov
    • Syntax Hero

    The API in the Joomla component is documented to such level that without knowing Joomla you can create a plugin for the component.

    Unfortunately I have too many tasks to work on, so can't learn Joomla.

    if there is a way to give a trial period for new members like

    You need to create such subscription in admin dashboard and use its id in your plugin. Something like this:

    $member = new M_Membership($user_id);
    $member->create_subscription(1 /* your subscription id here*/);
  • Yonatan Kra
    • Site Builder, Child of Zeus

    Hi,
    Thanks.
    I did not intend you to learn Joomla, just to show you how their API is set and how easy it is to use it.
    I'm trying the code you gave me in a plugin, but it doesn't work.
    Do I need to include any files in my plugin?
    Thanks,
    Yonatan

  • Yonatan Kra
    • Site Builder, Child of Zeus

    I have some more questions:
    1) Can I autosetup a blog for a subscriber upon registering to the site with his username as the blog address (e.g. http://username.mydomain.com)?
    2) Can I redirect all the pages and posts in a blog to another page (i.e. "your subscription is overdue" page) that his owner does not have a certain subscription?
    3) Can I create a default blog that will be replicated every time a user creates a new blog?
    Thanks,
    Yonatan

  • Jack Kitterhing
    • Code Norris

    Hiya Yonatan,

    Hope your well today, are we talking about WordPress here?

    1), You can do this by activating WordPress Multisite, we have a great guide on this here https://premium.wpmudev.org/blog/wordpress-multisite-guide/

    2),This should be done from membership > options > membership pages with the protected content page.

    3), Sure, you can use multisite with our new blog templates plugin here https://premium.wpmudev.org/project/new-blog-template/, using that you can set a default site that is replicated each time someone creates one.

    Thank you!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.