Tagged: message
Hello Abhist,
Thank you for posting. Please use the following code:
add_action( 'bp_set_member_type', function ( $user_id, $member_type ) { // $user_id ID of the user whose member type has been updated. // $member_type The member type name or an array of member type names. $user = get_user_by( 'id', $user_id ); if ( ! $user ) { return; } // Provide the email subject. $subject = ''; // Provide the email message. $message = ''; @wp_mail( $user->user_email, $subject, $message ); } );
Please check and let me know if it helps or not.
Regards
RaviHello,
Try the following code:
add_action( 'bp_set_member_type', function ( $user_id, $member_type ) { // If message component not exists return. if ( ! bp_is_active( 'messages' ) ) { return; } // $user_id ID of the user whose member type has been updated. // $member_type The member type name or an array of member type names. $user = get_user_by( 'id', $user_id ); if ( ! $user ) { return; } // Provide the email subject. $subject = ''; // Provide the email message. $message = ''; // Send only if member type send by other user. You may skip this. if ( get_current_user_id() != $user->ID ) { messages_new_message( array( 'sender_id' => get_current_user_id(), 'recipients' => array( $user->ID ), 'subject' => $subject, 'content' => $message, ) ); } } );
Regards
RaviHi,
You are welcome.
I am sorry, I lack the time to assist you further with custom code.
Please take a look at this page, especially the bottom links to see how to create BuddyPress Notifications.
https://codex.buddypress.org/administrator-guide/notifications/
Regards
Ravi
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.
This topic is: not resolved