wpf_user_imported

#Overview

This action is triggered whenever a new user is imported from your CRM (usually via a webhook), and after the user account has been created.

#Parameters

  • $user_id: The user ID of the newly created user
  • $user_meta: The meta data imported with the new user

#Examples

#Send a welcome email

The example below will send a welcome email to the new user containing their generated password.

function my_import_notification( $user_id, $user_meta ) {

	$to      = $user_meta['user_email'];
	$subject = 'Welcome to ' . get_bloginfo();
	$message = "You have a new user account on " . get_bloginfo() . ":\n\n";
	$message .= "Username: " . $user_meta['user_email'] . "\n";
	$message .= "Password: " . $user_meta['user_pass'] . "\n";

	wp_mail( $to, $subject, $message );

}

add_action( 'wpf_user_imported', 'my_import_notification', 10, 2 );

#Apply a tag

The example below will apply a tag with ID 123 to any new user after they’ve been successfully imported.

function my_import_tag( $user_id, $user_meta ) {

	wp_fusion()->user->apply_tags( array( '123' ), $user_id );

}

add_action( 'wpf_user_imported', 'my_import_tag', 10, 2 );

Was this helpful?