Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expire Users for Easy Digital Downloads registration form #40

Open
gasatrya opened this issue Sep 16, 2015 · 0 comments
Open

Expire Users for Easy Digital Downloads registration form #40

gasatrya opened this issue Sep 16, 2015 · 0 comments

Comments

@gasatrya
Copy link

I took your code to hook to WooCommerce registration/purchase, I slightly modified the code to work with Easy Digital Downloads

/**
 * Set expire
 */
function prefix_user_expire( $payment_id = 0 ) {

    global $expire_users;

    if ( ! class_exists( 'Expire_User' ) ) {
        return;
    }

    $expire_settings = $expire_users->admin->settings->get_default_expire_settings();
    $expire_data = array(
        'expire_user_date_type'         => $expire_settings['expire_user_date_type'],
        'expire_user_date_in_num'       => $expire_settings['expire_user_date_in_num'],
        'expire_user_date_in_block'     => $expire_settings['expire_user_date_in_block'],
        'expire_user_date_on_timestamp' => $expire_settings['expire_timestamp'],
        'expire_user_role'              => $expire_settings['expire_user_role'],
        'expire_user_reset_password'    => $expire_settings['expire_user_reset_password'],
        'expire_user_email'             => $expire_settings['expire_user_email'],
        'expire_user_email_admin'       => $expire_settings['expire_user_email_admin'],
        'expire_user_remove_expiry'     => $expire_settings['expire_user_remove_expiry']
    );
    $user_id = edd_get_payment_user_id( $payment_id );
    $user    = new Expire_User( $user_id );
    $user->set_expire_data( $expire_data );
    $user->save_user();

}
add_action( 'edd_complete_purchase', 'prefix_user_expire', 10, 3 );

It worked perfectly, but do you know how to expire the login form?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants