Hello,
Thank you again for the added hooks.
I’ve noticed the message objects appear with the field ‘meta’ always empty when I use the new hook:
wp.hooks.addFilter('better_messages_single_message_class', 'custom_action', function (classes, message) {
console.log( message ); // Here you can get message object
classes += ' msg-custom';
return classes; // Processing to default click event
})
I’m sending a message programmatically like this:
$args = array(
'sender_id' => $sender_id,
'thread_id' => $thread_id['thread_id'],
'recipients' => $recipient_id,
'subject' => '',
'content' => '<span class="donation-msg">' . $message . '</span>', //'<span class="donation_client">(' . $amount. ')</span><span class="donation_subs">(' . $share. '€)</span>',
'meta' => array('donation'),
'meta_data' => array('donation' => abs($amount)),
'date_sent' => bp_core_current_time(),
'return' => 'message_id'
);
$message_id = Better_Messages_Functions()->new_message( $args );
I see that in the public function new_message in ./inc/functions.php, it is creating the object BM_Messages_Message and then setting its ‘meta’ field to the one in $args passed to the function: $message->meta = $r['meta'];
. However, I’m not seeing this field declared inside the BM_Messages_Message class.
Maybe the reason the field ‘meta’ comes out always empty in the browser console, is because it’s not declared yet in the BM_Messages_Message class?
Thank you.