Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Deliver Custom Message via BuddyPress to new users

@henrywright

Moderator

@hnla you’re right, it could be more robust. I’ve added a conditional check to test if the messages component is active.

function send_message_to_new_member( $user_id, $key, $user ) {

    if ( ! bp_is_active( 'messages' ) )
        return;

    $args = array(
        'sender_id' => 1,
        'thread_id' => false,
        'recipients' => $user_id,
        'subject' => 'Hello new user',
        'content' => 'Welcome to the site',
        'date_sent' => bp_core_current_time()
    );

    $result = messages_new_message( $args );
}
add_action( 'bp_core_activated_user', 'send_message_to_new_member', 3 );

I think editing the codex is off-limits to the masses right now, although you may have access? See here.

Skip to toolbar