How to add welcome message for new users?

You are here:
< All Topics

This snippet will add welcome message on user register when you are using BuddyPress in your website. It will work with BP Better Messages plugin perfectly. If you are running BP Better Messages without BuddyPress plugin, this will not work.

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

    $args = array(
        'sender_id'  => 1,
        'thread_id'  => false,
        'recipients' => $user_id,
        'subject'    => 'Welcome to',
        'content'    => "<strong>Welcome to</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 = messages_new_message( $args );
add_action('bp_core_activated_user', 'bp_messages_welcome_message', 10, 3);
Perfect place to put this snippet is child theme functions.php file.
Previous Control if user can upload files with hook
Next How to replace email notifications with custom layout?
Table of Contents