Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

[Resolved] How to automatically login after registration using API

Simple Membership Plugin › Forums › Simple Membership Plugin › How to automatically login after registration using API

Tagged: api, Registration

  • This topic has 1 reply, 2 voices, and was last updated 4 years ago by mbrsolution.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 6, 2022 at 5:43 pm #23849
    qwerqwessdfasdf
    Participant

    I would like to know how to log in a user automatically after registering them via the API

    I use curl from a PHP script in the WordPress site theme to register the user, then I want them to be logged in so I can direct them into the member portions of the site

    Here is the code I am using to perform the registration. The registration is working correctly. I would like to log the user in after the registration completes successfully

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, get_site_url() . “/”);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, ‘curl’);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_arr);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    if (curl_errno($ch)) {
    $error_msg = curl_error($ch);
    }
    curl_close($ch);

    $result = json_decode($response, true);

    if ($result[‘result’] == ‘success’) {
    //log in the user
    }

    May 8, 2022 at 11:05 pm #23864
    mbrsolution
    Moderator

    Hi,

    The API related questions are beyond the scope of the free support (since a developer needs to investigate your particular use case). This needs to be handled using a paid support ticket.

    https://simple-membership-plugin.com/paid-support-simple-membership-plugin/

    Thank you.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy