Auto Register

The Auto Register extension for Easy Digital Downloads streamlines the process of making new customers into WordPress users. Typically to have customers also register as WordPress users you would have to include the account creation fields in the checkout form.  Auto Register takes the existing data and automatically creates a user from it, removing an entire step from the checkout process.

Setup

You can find the Auto Register configuration under Downloads → Extensions. Your options are:

  • Disable the email sent to the user that contains login details
  • Disable the new user registration email sent to the admin

Customer Experience

The customer will not see anything on your checkout page that indicates that their information is going to be saved as a user. Auto Register uses the normal EDD checkout fields to gather it's information.

Note: with Auto Register turned on, as soon as someone makes a purchase they will be logged into WordPress as a subscriber.

Common Questions

What happens if someone already has an account and make a new purchase while logged out?

If a user account already exists for the customer, for security reasons the customer must log in before purchasing a recurring product.

How can I disable the email from sending to the customer?

There's an option under Downloads -> Settings -> Extensions -> Main

How can I modify some of the key aspects of the plugin?

There are filters available to modify the behavior of the plugin, see the list below:

  • edd_auto_register_email_subject
  • edd_auto_register_headers
  • edd_auto_register_insert_user_args
  • edd_auto_register_email_body
  • edd_auto_register_error_must_login
  • edd_auto_register_login_form
  • edd_auto_register_disable

Can you provide a filter example of how to change the email's subject?

Add the following to your child theme's functions.php

    function my_child_theme_edd_auto_register_email_subject( $subject ) {

        // enter your new subject below
	    $subject = 'Here are your new login details';

	    return $subject;

    }
    add_filter( 'edd_auto_register_email_subject', 'my_child_theme_edd_auto_register_email_subject' );

Can you provide a filter example of how to change the email's body?

Add the following to your child theme's functions.php

function my_child_theme_edd_auto_register_email_body( $default_email_body, $first_name, $username, $password ) {

	// Modify accordingly
	$default_email_body = __( "Dear", "edd-auto-register" ) . ' ' . $first_name . ",\n\n";
	$default_email_body .= __( "Below are your login details:", "edd-auto-register" ) . "\n\n";
	$default_email_body .= __( "Your Username:", "edd-auto-register" ) . ' ' . $username . "\n\n";
	$default_email_body .= __( "Your Password:", "edd-auto-register" ) . ' ' . $password . "\n\n";
	$default_email_body .= __( "Login:", "edd-auto-register" ) . ' ' . wp_login_url() . "\r\n";

	return $default_email_body;

}
add_filter( 'edd_auto_register_email_body', 'my_child_theme_edd_auto_register_email_body', 10, 4 );

Can you provide an example how to disable auto register for specific products?

Add the following to your child theme's functions.php

/*
 * Disable auto register for specific products
 */
function my_child_theme_disable_auto_register() {
	$cart_contents = edd_get_cart_contents();
	if ( ! $cart_contents ) {
		return;
	}
	foreach ( $cart_contents as $key => $item ) {
		$items[] = $item['id'];
	}
	// List of download ids that require auto register
	$items_for_auto_register = array( '21', '987' );
	// If there are no downloads that require auto register then disable it.
	if ( ! array_intersect( $items, $items_for_auto_register ) ) {
		add_filter( 'edd_auto_register_disable', '__return_true', 11 );
	}
}
add_action( 'init', 'my_child_theme_disable_auto_register', 11 );