Community

Connecting WordPress People

Error when using the 'get_threads' function.

MMaarten 6 replies 0 views 2 readers

  1. New
    #1

    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 wp_bm_message_messages
    WHERE thread_id = 34
    ORDER BY date_sent 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 " . bm_get_table('messages') . "
    WHERE thread_id = %d
    ORDER BY date_sent DESC
    LIMIT 0, 1
    ", $thread->thread_id ) );

    More reactions: press the Down arrow
    views
  2. New
    Admin
    #2

    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!

    More reactions: press the Down arrow
  3. New
    #3

    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…

    More reactions: press the Down arrow
  4. New
    Admin
    #4

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

    More reactions: press the Down arrow
  5. New
    #5

    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.

    More reactions: press the Down arrow
  6. New
    Admin
    #6

    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.

    More reactions: press the Down arrow
  7. New
    #7

    Ok, great, good to know. Thank you!

    More reactions: press the Down arrow
0