Auto Login Links

Auto Login Links are integrated with all outgoing emails if there is a user with the recipient email address.

It will be integrated into all outgoing emails unless:

  • more than one recipient. (including cc/bcc addresses)
  • If the mail excluded
  • The user does not exist with the given email address.

Hooks:

magic_login_add_auto_login_link: filter to modify whether add or not add login links at the end of the mail. It allows programmatically disable auto login links.

magic_login_auto_login_link_message: filter to modify appended login message.

magic_login_auto_login_link_excluded: filter whether auto login link excluded or not for given email

magic_login_auto_login_excluded_subjects: filter for alter excluded subjects.

By default, the login links won’t be sent with the following messages:

  • [%s] New Admin Email Address
  • [%s] Network Admin Email Change Request
  • [%s] Admin Email Changed
  • [%s] Notice of Network Admin Email Change
  • [%s] Login Details
  • [%s] Password Reset
  • [%s] Password Changed
  • [%s] Email Change Request

Example usages:

// disables auto login link 
add_filter( 'magic_login_add_auto_login_link', '__return_false' ); 

add_filter( 'magic_login_auto_login_link_message', function ( $message, $link, $user ) {
	// modify the existing $message here and return the value
}, 10, 3 );


add_filter( 'magic_login_auto_login_link_excluded', function ( $is_excluded, $atts ) {
	if ( '[email protected]' === $atts['to'] ) {
		return false;
	}

	return $is_excluded;
}, 10, 2 );


add_filter( 'magic_login_auto_login_excluded_subjects', function ( $subjects ) {
	$subjects[] = 'Another email subject that I do not want to add auto login links';

	return $subjects;
} );

This feature has been available since version 1.6