Home Forums BP Better Messages Error when using the ‘get_threads’ function.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #19045
    Maarten
    Participant

    I get the following error when using the get_threads function, and it currently doesn’t return any threads:

    WordPress database error Unknown column 'subject' in 'field list' for query 
    SELECT id, sender_id as user_id, subject, message, date_sent
    FROM  <code>wp_bm_message_messages</code> 
    WHERE <code>thread_id</code> = 34
    ORDER BY <code>date_sent</code> DESC 
    LIMIT 0, 1

    When I remove ‘subject’ in /inc/functions.php on row 589, it works again.

    $last_message = $wpdb->get_row( $wpdb->prepare( "
    SELECT id, sender_id as user_id, message, date_sent
    FROM  <code>&quot; . bm_get_table('messages') . &quot;</code> 
    WHERE <code>thread_id</code> = %d
    ORDER BY <code>date_sent</code> DESC 
    LIMIT 0, 1
    ", $thread->thread_id ) );
    • This topic was modified 1 year, 10 months ago by Maarten.
    #19047
    Support
    Keymaster

    Hi there!

    Sorry, this function is not used in BM 2.0 anymore, but I didnt removed it yet.
    Will review/make compatible it soon and add to docs.

    Thanks!

    #19049
    Maarten
    Participant

    Ah, thanks for letting me know. I am using this function for my current theme, is there a BM 2.0 way to get the current threads of a user? So I can update my code and be ready for the changes…

    #19052
    Support
    Keymaster

    Im not sure what is the way you are using it to suggest something else

    #19053
    Maarten
    Participant

    At the moment I am simply doing:

    $threads = BP_Better_Messages()->functions->get_threads($current_user->ID);
    foreach ($threads as $thread) {
    // something
    }

    I’m happy to keep doing this, I was just wondering if this function will be deprecated, what to do then.

    #19054
    Support
    Keymaster

    I already added fallback to that function, but it will output different data (not the same as in V1), so check the response after update.

    #19055
    Maarten
    Participant

    Ok, great, good to know. Thank you!

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