Send message after user registration via Gianism
At v3.1, Gianism does not send a message to users when they create accounts by default. It’s because some SNS don’t provide users’ email address. But sometimes some kind of users will appear who delete their SNS account without remembering email and password.
For them, we describe how to send email on user registrations.
Use wpg_connect
wpg_connect
is an action hook triggered when a user registers or logs in to your WordPress via
add_action( 'wpg_connect', function( $user_id, $data, $service, $on_creation ) { // Execute only for registration. if ( ! $on_creation ) { return; } // Get user info. $user = get_userdata( $user_id ); // Send email $subject = 'Welcome to Gianism!'; $message = sprintf( 'Dear %s, thank you for regisration.', $user->display_name ); wp_mail( $user->user_email, $subject, $message ); }, 10, 4 );
Notice
Users who created their account via Gianism sometimes don’t have email xxx@pseudo.example.jp
So you might have to check email address to avoid sending an undeliverable email.
if ( false !== strpos( $user->user_email, '@pseudo.' ) ) { // This user has psuedo email. return; }
For premium users
For premium users, we add an extra sample plugin to your Gumroad library. Please log in and download it.