Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sending private message programatically failing in AJAX call


  • cjerrells
    Participant

    @cjerrells

    Hi,

    I’m implementing a custom AJAX handler which calls messages_new_message() to send a private message on behalf of a user.

    This sort of works, in that the message is getting sent, and email notification triggered etc. However, none of my code in the callback placed after the messages_new_message call gets executed.

    I tried to pin it down and it seems like something’s going wrong at the do_action line right before messages_new_message’s return:

    do_action_ref_array( 'messages_message_sent', array( &$message ) );

    If I insert an error_log call above that line, it gets executed. If I insert one after, it doesn’t.

    I had a look at each of the actions added to that hook in the BuddyPress source and couldn’t find anything triggering a redirect or calling wp_die() or anything, and I checked that no other plugins I have installed are hooking onto that.

    I’m a bit stumped. Is there some reason that calling messages_new_message() from an AJAX handler would fail, or some way I can debug this further?

    Thanks in advance for any help!

Viewing 1 replies (of 1 total)

  • shanebp
    Moderator

    @shanebp

    Are you checked to see if any other code is hooking that do_action_ref_array? Maybe another plugin?
    Or perhaps some other ajax-related code in your theme or another plugin?

    Maybe check to see if not passing the $message object by reference in that hook makes any difference.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar