• Resolved TC.K

    (@wp_dummy)


    Hi,
    I want the users account deleted once they are cancel their subscription. However, their posts still remain in the site. How can I do that?

    I noticed their is a thread that talk about this, here. However, that is the solution for prior v1.4.

    The pmpro_delete_user seem already included in the newer version of PMP. But I still doesn’t see how to use it. Do I need to changing their membership level to 0, manually? Or it already in the system that the user level will become 0 when they cancel the subscription?

    https://www.ads-software.com/extend/plugins/paid-memberships-pro/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jason Coleman

    (@strangerstudios)

    With the latest PMPro version, you should just be able to add this code to your functions.php (or a blank plugin) to get the functionality you want:

    https://gist.github.com/2185226

    (The rest of that thread talked about how to patch PMPro to work with that code, but the latest versions have the hooks in place.)

    Let me know if this works.

    Thank you for this code. It works almost perfectly, however I get a strange email when someone cancels:

    There was an error canceling the subscription for user with ID=5. You will want to check your payment gateway to see if their subscription is still active.

    Error: not is changing?

    Last Invoice:
    stdClass::__set_state(array(
    ‘id’ => ‘4’,
    ‘code’ => ’81E76DC8B5′,
    ‘session_id’ => ‘ks5u5tefpa6jfsr2mfkvikp3d0’,
    ‘user_id’ => ‘5’,
    ‘membership_id’ => ‘2’,
    ‘paypal_token’ => ”,
    ‘billing_name’ => ‘Test Testing’,
    ‘billing_street’ => ‘123 Easy St’,
    ‘billing_city’ => ‘Palo Alto’,
    ‘billing_state’ => ‘California’,
    ‘billing_zip’ => ‘94303’,
    ‘billing_country’ => ‘US’,
    ‘billing_phone’ => ‘4083728674’,
    ‘subtotal’ => ‘125.00’,
    ‘tax’ => ‘0’,
    ‘couponamount’ => ”,
    ‘certificate_id’ => ‘0’,
    ‘certificateamount’ => ”,
    ‘total’ => ‘125’,
    ‘payment_type’ => ”,
    ‘cardtype’ => ‘Visa’,
    ‘accountnumber’ => ‘XXXXXXXXXXXX0000’,
    ‘expirationmonth’ => ’01’,
    ‘expirationyear’ => ‘2013’,
    ‘status’ => ‘cancelled’,
    ‘gateway’ => ”,
    ‘gateway_environment’ => ‘sandbox’,
    ‘payment_transaction_id’ => ‘TEST81E76DC8B5’,
    ‘subscription_transaction_id’ => ‘TEST81E76DC8B5’,
    ‘timestamp’ => ‘2013-02-05 10:11:17’,
    ‘affiliate_id’ => ”,
    ‘affiliate_subid’ => ”,
    ))

    However, it still works and deletes the WP user as expected.

    Any thoughts?

    Plugin Author Jason Coleman

    (@strangerstudios)

    @tophersimon, what’s happening is PMPro is trying to cancel their subscription twice. Once when they cancel and then again when the account is deleted (because PMPro hooks into user deletion to cancel the users account – basically the other order of doing things).

    The email is harmless. Their subscription will have been cancelled.

    I will try to update the code so it doesn’t do the double cancel.

    Plugin Author Jason Coleman

    (@strangerstudios)

    @tophersimon, I’ve updated the gist to avoid the double cancel issue. Let me know if this works for you.

    https://gist.github.com/2185226

    Thanks! Works perfectly now. You rock!

    Plugin Author Jason Coleman

    (@strangerstudios)

    Thanks. Just resolving this thread.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Paid Memberships Pro] Delete User account when cancel PMP subscription’ is closed to new replies.