How to add welcome message for new users?

You are here:
< All Topics

This snippet will add welcome message on user register at your website.

function bp_messages_welcome_message( $user_id = false, $key = false, $user = false ){
    if ( ! function_exists( 'BP_Better_Messages' ) ) return false;

    $args = array(
        'sender_id'  => 1,
        'thread_id'  => false,
        'recipients' => $user_id,
        'subject'    => 'Welcome to WordPlus.org',
        'content'    => "<strong>Welcome to WordPlus.org</strong>\n\n If you have any question about <strong>BP Better Messages</strong> you can ask it here directly.",
        'date_sent'  => bp_core_current_time()
    );

    $result = BP_Better_Messages()->functions->new_message( $args );
}
// For BuddyPress
add_action('bp_core_activated_user', 'bp_messages_welcome_message', 10, 3);
// For BuddyPress (if first one does not works)
add_action('bp_core_signups_after_add_backcompat', 'bp_messages_welcome_message', 10, 1);
// For Not BuddyPress
add_action('register_new_user', 'bp_messages_welcome_message', 10, 1);
Perfect place to put this snippet is child theme functions.php file.
Previous Ending call dynamically (WebSocket version)
Next How to replace email notifications with custom layout?
Table of Contents