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

[Support request] Auto log-in a member created by another plug-in

Simple Membership Plugin › Forums › Simple Membership Plugin › Auto log-in a member created by another plug-in

Tagged: login woocommerce registration

  • This topic has 1 reply, 2 voices, and was last updated 8 years, 4 months ago by The Assurer.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • April 17, 2018 at 5:34 am #14154
    tyhwer
    Participant

    Hi!

    I am trying to auto log-in the member that is created by Woocommerce when the visitor purchases a membership. I’m using the SWPM WooCommerce Addon for that, and everything is working fine. I auto log in users successfully to WP, with the following function:

    function auto_login_new_user($order_id) {
    
        $order = new WC_Order( $order_id ); 
        $user_id = $order->get_customer_id();
        $user = get_user_by( 'id', $user_id ); 
    
        wp_set_current_user( $user_id, $user->user_login );
        wp_set_auth_cookie( $user_id );
        do_action( 'wp_login', $user->user_login );
    
        }
    
    add_action('woocommerce_checkout_order_processed', 'auto_login_new_user');
    

    This logs the user into WP but not SWPM. I tried adding this inside the function:

    do_action('swpm_login', $user->user_login, $user->user_pass, true);

    but the problem is that $user->user_pass returns the hashed password, and swpm_login requires the unhashed password.

    Is there any way to do this? I can’t figure out how to:

    – Either return an unhashed password into swpm_login
    – Or login into SWPM in a way that doesn’t require passwords, similar to how wp_set_current_user and wp_set_auth_cookie only need the user ID.

    Thank you very much and regards,
    Gabriel

    April 17, 2018 at 11:08 am #14157
    The Assurer
    Moderator

    Hashed passwords cannot be hashed.

    Yes, there probably is a way to accomplish what you are trying to do, but please realize this request is outside the scope of the free technical support. I am required to refer you to our paid support service, for further assistance in this matter:
    https://simple-membership-plugin.com/paid-support-simple-membership-plugin/

  • 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