Skip to:
Content
Pages
Categories
Search
Top
Bottom

Cannot find functions defined somewhere in BP core


  • artempr
    Participant

    @artempr

    messages_message_subject_before_save();
    I searched for this function for 2 days and found nothing. Even Google did not give me anything. So, I would be absolutely happy if someone get aquainted me to the sourse code of that function or with any of these:
    messages_message_sender_id_before_save,
    messages_message_content_before_save…etc.
    Because what they really do is a mystery for me.

Viewing 7 replies - 1 through 7 (of 7 total)

  • Henry Wright
    Moderator

    @henrywright

    messages_message_subject_before_save isn’t a function which is probably why you had trouble finding it. It’s a filter inside class-bp-messages-message.php. The full path to the file is bp-messages/classes/class-bp-messages-message.php.


    danbp
    Participant

    @danbp

    Enter what you search for into the searchbox, and read the result !
    http://hookr.io/plugins/buddypress/#index=a


    artempr
    Participant

    @artempr

    oh,thanks,Henry. That mean , i can simply hook to these filters ?
    I m kind of not pro in php (java coder) thats why i could have some misunderstanding for now)


    artempr
    Participant

    @artempr

    @danbp, Thanks, actually I was already trying to search on this site some info earlier but my antivirus was banning it. )


    Henry Wright
    Moderator

    @henrywright

    @artempr yes you can but it’s recommended you use the messages_message_before_save action instead of the individual filters:

    messages_message_sender_id_before_save
    messages_message_thread_id_before_save
    messages_message_subject_before_save
    messages_message_content_before_save
    messages_message_date_sent_before_save

    You can use it like this:

    add_action( 'messages_message_before_save', function( $message ) {
        // $message->sender_id
        // $message->thread_id
        // $message->subject
        // $message->message
        // $message->date_sent
    } );

    I believe the $message object is passed by reference so you can modify the properties inside your function.


    artempr
    Participant

    @artempr

    Nice , Thanks. Actually i d like to change messaging logic a little bit. In case of writing to user a private message i d like not to create a new message thread object, but to search instead for existing message thread between me and the user. If there is one, send my message to that thread and open existing dialog. I ve researched send function and i came to conclusion ,that i must change the function.
    I believe that wont hurt the logic.I m alomost sure. What d say other participants about my idea?


    Henry Wright
    Moderator

    @henrywright

    I wouldn’t recommend changing core files because when you update BuddyPress, you’ll lose all of your modifications.

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