Skip to content

HandyPlugins

  • Home
  • PluginsExpand
    • Magic Login Pro
    • Handywriter
    • WP Accessibility Toolkit
    • PaddlePress Pro
    • Easy Text-to-Speech
  • Docs
  • About
  • Blog
  • Contact
My Account
HandyPlugins
Popular Search shortcodethehookemailredirect

Magic Login Pro

36
  • Installation & Configuration
  • Use magic login as the default login method?
  • Brute Force Protection
  • WooCommerce Integration
  • Easy Digital Downloads (EDD) Integration
  • Token Lifespan
  • Disable Magic Login for a Specific User
  • Login with Code: Flexible Passcode-Based Authentication
  • SMS Login – Passwordless Authentication with SMS
  • Magic Login REST API
  • QR Code Login
  • CLI Command
  • Add Login form to a Page
  • Reset Tokens
  • Auto Login Links
  • Token Validity
  • Login Redirect
  • Shortcode
  • Login Email Customization
  • Login Request Throttling
  • IP Check
  • Domain Restriction
  • Registration
  • Spam Protection
  • How to Add Magic Login to Any of Outgoing Emails?
  • Customize Default Messages
  • nG Firewall
  • Dynamically Adjust Token TTL
  • How to change Sender Details?
  • Disable Magic Login for specific roles
  • Customizing Login Session Duration
  • Magic Login Twilio Integration
  • Magic Login – FluentCRM Integration
  • Reset Magic Login Links for a User
  • Hooks
  • Tools – Reset, Export & Import Magic Login Settings

PaddlePress Pro

26
  • Installation & Configuration
  • How does PaddlePress PRO work?
  • Automatic account creation
  • How to set up a membership website?
  • Setup a Development Environment
  • Protect Download Files on NGINX
  • Software Licensing
  • Software Licensing API
  • Updater Implementation for WordPress Plugins
  • Updater Implementation for WordPress Themes
  • Release a New WordPress Product
  • Customer Dashboard (My Account) Page
  • Checkout Buttons
  • Custom Redirect After Successful Checkout
  • How does the domain count?
  • Emails
  • Accessing Readme through a Shortcode
  • How to Sell WordPress Products?
  • Releasing Beta Versions of a WordPress Product
  • Paddle Billing
  • Customer Dashboard
  • Membership Levels
  • Restrict Content
  • Add a Custom Payment Action
  • How to customize “Download” Button?
  • Adding Manual Payments

Handywriter

11
  • Installation & Configuration
  • Write a Blog Post
  • Create a Summary
  • Suggest a Title
  • Keep records of AI generated Contents
  • Grammar & Spelling Fixer
  • Plagiarism Check
  • Content Templates
  • How to create a Meta Description?
  • How to complete a sentence?
  • How does credit calculation work?

Easy Text-to-Speech

5
  • Installation & Configuration
  • Using with Block Editor
  • Using with Classic Editor
  • OpenAI Integration
  • ElevenLabs Integration

WP Accessibility Toolkit

3
  • Customization
  • Hotkeys: Quick Navigation and Efficiency
  • Do not show the accessibility toolkit on the specific page

FAQ

1
  • How to Enter Your VAT Number for VAT Deduction at Checkout
  • Home
  • Docs
  • Magic Login Pro
  • How to Add Magic Login to Any of Outgoing Emails?
View Categories

How to Add Magic Login to Any of Outgoing Emails?

It’s easy to integrate Magic Login links with outgoing WordPress emails. Simply use the {{MAGIC_LINK}} placeholder, and it will be converted to an actual login link when the email is sent.

Personalization at Its Best #

To add a personal touch to your emails, we’re introducing additional placeholders for further customization. You can use {{FIRST_NAME}}, {{LAST_NAME}}, {{FULL_NAME}}, {{DISPLAY_NAME}}, and {{USER_EMAIL}} to make each email feel tailored to the recipient, enhancing engagement and trust.

Limitations #

For security reasons, some limitations similar to those of the auto-login links feature apply here as well:

  • Multiple Recipients: Magic Login links cannot be sent to more than one recipient, including CC/BCC addresses.
  • Excluded Emails: Emails excluded from sending will not contain Magic Login links.
  • Non-existent Users: If the email address provided does not match an existing user, the Magic Login link will not be generated.

Hooks #

magic_login_replace_magic_link_in_wp_mail: to control {{MAGIC_LINK}} behaviour.

e.g: Let’s use this filter to check if the user is an admin and return false if they are. This will abort the email sending process. Here’s how you can do it:

add_filter( 'magic_login_replace_magic_link_in_wp_mail', 'custom_magic_link_control_for_admin', 10, 3 );

function custom_magic_link_control_in_wp_mail_for_admin( $replace, $atts, $user ) {
	// Check if the user is an admin
	if ( user_can( $user, 'administrator' ) ) {
		// Abort the email sending process
		return false;
	}

	return $replace;
}

magic_login_replace_magic_link_in_wp_mail_message: to modify generated magic link for wp_mail integration.

e.g: Add redirect_to parameter based on the role.

add_filter( 'magic_login_replace_magic_link_in_wp_mail_message', 'add_custom_redirect_based_on_role', 10, 2 );

function add_custom_redirect_based_on_role( $magic_link, $atts ) {
	// Get the user by email
	$user = get_user_by( 'email', $atts['to'] );

	// Check if the user is an administrator
	if ( user_can( $user, 'administrator' ) ) {
		// Replace the magic link with a custom URL
		$magic_link = add_query_arg( 'redirect_to', urlencode( admin_url() ), $magic_link );
	} else {
		$magic_link = add_query_arg( 'redirect_to', urlencode( site_url( '/my_account' ) ), $magic_link );
	}

	return esc_url( $magic_link );
}

Was this guide helpful for you?
Updated on May 14, 2024
Spam ProtectionCustomize Default Messages
Table of Contents
  • Personalization at Its Best
  • Limitations
  • Hooks

HandyPlugins

Explore

Home
Blog
Contact Us
My Account

Products

Magic Login Pro
Handywriter
Easy Text-to-Speech
PaddlePress Pro
WP Accessibility Toolkit

Follow Us

Twitter
Facebook
GitHub
WordPress

2025 – HandyPlugins.co | Hosted on WPHandle and optimized with Powered Cache

  • Terms and Conditions
  • Privacy Policy
  • Cookie Policy
  • Home
  • Plugins
    • Magic Login Pro
    • Handywriter
    • WP Accessibility Toolkit
    • PaddlePress Pro
    • Easy Text-to-Speech
  • Docs
  • About
  • Blog
  • Contact
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkPrivacy policy