Front End PM

Print

Send welcome message when user register


Want to welcome your users nicely? you can send them a message. Add following code in your theme’s (child theme’s if any) functions.php

 

add_action( 'user_register', 'fep_cus_user_register_send_messaage', 10, 1 );

function fep_cus_user_register_send_messaage( $user_id ){
        if ( $user_id < 1 )
                return;
        if ( ! function_exists( 'fep_send_message' ) )
                return;
 
        // Prepare message data
        $message = array(
             'message_title' => 'Welcome ' . fep_get_userdata( $user_id, 'display_name', 'id' ), //change with message title
             'message_content' => 'CONTENT', //change with message content
             'message_to_id' => $user_id
        );

        $override = array(
             'mgs_author' => 1, //change with message sender id
        );

        // Send message
       fep_send_message( $message, $override );      
}