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 not working with WooCommerce registration form #39

Open
benhuson opened this issue Jul 29, 2015 · 3 comments
Open

Expire Users not working with WooCommerce registration form #39

benhuson opened this issue Jul 29, 2015 · 3 comments

Comments

@benhuson
Copy link
Owner

See https://wordpress.org/support/topic/expire-users-not-working-with-woocommerce-registration-form?replies=2#post-7232639

@benhuson
Copy link
Owner Author

Possibly need to use this hook: 'woocommerce_created_customer'
http://docs.woothemes.com/wc-apidocs/source-function-wc_create_new_customer.html#115

Something like the following (note: completely un-tested):

<?php

function expire_user_woocommerce_created_customer( $customer_id, $new_customer_data, $password_generated ) {

    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 = new Expire_User( $customer_id );
    $user->set_expire_data( $expire_data );
    $user->save_user();

}
add_action( 'woocommerce_created_customer', 'expire_user_woocommerce_created_customer', 10, 3 );

?>

@Makr91
Copy link

Makr91 commented Nov 13, 2017

Can you clarify in which file I should place this?

@benhuson
Copy link
Owner Author

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