Thanks a lot, my function now works. Maybe I made sth wrong with these parameters. Messages now appear in database, the problem is that PMs are enabled in buddypress settings. I guess I will have to implement inbox myself, as it would be faster
At first I tried to send arguments the way you suggested in last post, but it didn’t work, so I tried to do it in url-style. None of these worked so far.
The function I wrote is as following –
function send_msg($user_id, $title, $message){
$args = “recipients=$user_id&sender_id’=11&subject’=$title&content’=$message”;
messages_new_message( $args );
}
I pass only recipients id, sender id, subject and content, due to call to wp_parse_args in messages_new_message, which fills message parameters which aren’t sent with default values, I believe. But it doesn’t affect database at all, no new messages are inserted.
—
About inbox, the installation I am working on is quite tweaked, so I don’t know what has been enabled and what disabled . But if pm’s are disabled, is there an easy way to enable them? Also if pm’s are disabled, will message_new_message function do anything at all?
Thanks for quick respond . I try to call this function, but it doesn’t seem to be working. Nothing is inserted into the bp_messages tables in wordpress db. BTW, how to open my inbox? I can’t find it even here on buddypress.org, and on the site I am working on it’s also invisible. Should I install some new plugin or what?