Support » Plugin: Simple Membership » Function to create membership from user ID

  • Resolved swinggraphics

    (@swinggraphics)


    Following up on this question, a simple function that would add a membership for a user would be wildly helpful, enabling integration with other plugins, like form builders. Something like, swpm_add_membership( (int) $user_id, (int) $membership_level, (bool) $send_notifications )

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Thank you for sharing your solution. I have submitted a message to the developers to investigate further your solution.

    Kind regards.

    Thread Starter swinggraphics

    (@swinggraphics)

    For anyone else looking for a solution, I found the swpm_handle_wp_user_registration method in “classes/class.simple-wp-membership.php”. You can copy the code used here to get user info and create a membership.

    Plugin Author wp.insider

    (@wpinsider-1)

    With our plugin the concept of membership level needs to be taken into account. So the best way to create accounts programmatically is to use the following API (which offers appropriate function):
    https://simple-membership-plugin.com/simple-membership-api-creating-member-account-using-http-post-request/

    Other option needs to be handled as a consultation job so a developer can really understand the use case of the individual project/site and offer an appropriate solution.

    Thread Starter swinggraphics

    (@swinggraphics)

    That’s a lot of unnecessary overhead, and much more complicated than a PHP function. An external API is fine for cross-site interaction, but this is on the same site, which I think is the majority of use cases.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Function to create membership from user ID’ is closed to new replies.