Home › Forums › BP Better Messages › Error when using the ‘get_threads’ function.
- This topic has 6 replies, 2 voices, and was last updated 5 months, 4 weeks ago by
Maarten.
- AuthorPosts
- December 9, 2022 at 1:25 pm #19045
Maarten
ParticipantI 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>" . bm_get_table('messages') . "</code> WHERE <code>thread_id</code> = %d ORDER BY <code>date_sent</code> DESC LIMIT 0, 1 ", $thread->thread_id ) );
-
This topic was modified 5 months, 4 weeks ago by
Maarten.
December 9, 2022 at 2:02 pm #19047Support
KeymasterHi 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!
December 9, 2022 at 3:34 pm #19049Maarten
ParticipantAh, 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…
December 9, 2022 at 5:08 pm #19052Support
KeymasterIm not sure what is the way you are using it to suggest something else
December 9, 2022 at 5:17 pm #19053Maarten
ParticipantAt 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.
December 9, 2022 at 5:20 pm #19054Support
KeymasterI already added fallback to that function, but it will output different data (not the same as in V1), so check the response after update.
December 9, 2022 at 5:24 pm #19055Maarten
ParticipantOk, great, good to know. Thank you!
-
This topic was modified 5 months, 4 weeks ago by
- AuthorPosts
- You must be logged in to reply to this topic.