inbox to new user automatic from admin
-
Hi!
I found this code to send a welcome message to the inbox of the user by role, but it doesnt works, any suggestion?
Thanks very much!!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, 'role' => 'author', '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 );
-
There is no
role
argument. Andrecipients
takes an array.Try:
$recipients = array( $user_id ); $args = array( 'sender_id' => 1, 'thread_id' => false, 'recipients' => $recipients, 'subject' => 'Hello new user', 'content' => 'Welcome to the site', 'date_sent' => bp_core_current_time() );
Hi! i tried but it isnt work.. i mean one message inside buddypress inbox like a user write to another.. is it?
function send_message_to_new_member( $user_id, $key, $user ) { if ( ! bp_is_active( 'messages' ) ) return; $recipients = array( $user_id ); $args = array( 'sender_id' => 1, 'thread_id' => false, 'recipients' => $recipients, '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 );
Warning: Cannot modify header information – headers already sent by (output started at public_html/home/wp-content/mu-plugins/message.php:1) in /public_html/home/wp-content/themes/eonet/inc/hooks.php on line 347
Warning: Cannot modify header information – headers already sent by (output started at public_html/home/wp-content/mu-plugins/message.php:1) in public_html/home/wp-admin/includes/misc.php on line 1198
I second this – would love to know ! 🙂
- You must be logged in to reply to this topic.