Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jcarignan

    (@jcarignan)

    Hello Nicolas and sorry about the late reply!

    Yes, that was I ended up doing, deleting the freshly-created user on a successful transaction callback.

    I would edit the code on your website + gist though, because if we are logged out but use the email of the main Administrator wordpress user, it will completely destroy the WP database! wp_delete_user deletes ALL the content associated with the user if we don’t use the second param!

    I still think there should be an option to completely bypass creating new WordPress Users when we don’t need to track purchases made with the same email address.

    This is what I use:

    
    function on_stripe_payment_completed($chargeID, $post_id, $button_id, $user_id) {
        if (!user_can($user_id, 'administrator') && user_can($user_id, 'stripe-user')) {
                $admin_user_id = get_users(array(
                    'role' => 'administrator',
                    'number' => 1,
                    'orderby' => 'ID'
                ))[0]->ID;
            wp_delete_user($user_id, $admin_user_id);
        }
    }
    

    Thanks!
    Julien

    • This reply was modified 7 years, 6 months ago by jcarignan.
    • This reply was modified 7 years, 6 months ago by jcarignan.
    • This reply was modified 7 years, 6 months ago by jcarignan.
    Thread Starter jcarignan

    (@jcarignan)

    Wow, sorry for the late response, never saw the email..! Yes indeed the count is still working after I made the change, thanks again for this great plugin!

Viewing 2 replies - 1 through 2 (of 2 total)