Add welcome message for new users
REQUIREMENTS
To be able to implement this guide, you need to learn how to insert PHP snippets to your website.
You can find guide here: WP Beginner
This snippet will automatically send welcome message to user which just registered at your website.
<?php
function bm_welcome_message( $user_id = false, $key = false, $user = false ){
if ( ! function_exists( 'Better_Messages' ) ) return false;
$args = array(
'sender_id' => 1, //Sender User ID
'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>Better Messages</strong> you can ask it here directly.",
'date_sent' => bp_core_current_time()
);
$result = Better_Messages()->functions->new_message( $args );
}
// For BuddyPress
add_action('bp_core_activated_user', 'bm_welcome_message', 10, 3);
// For BuddyPress (if first one does not works)
add_action('bp_core_signups_after_add_backcompat', 'bm_welcome_message', 10, 1);
// For Not BuddyPress
add_action('register_new_user', 'bm_welcome_message', 10, 1);
// For Ultimate Member
add_action('um_registration_complete', 'bm_welcome_message', 10, 2);