- This topic has 6 replies, 2 voices, and was last updated 1 year, 9 months ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.
Home › Forums › BP Better Messages › Error when using the ‘get_threads’ function.
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>" . bm_get_table('messages') . "</code>
WHERE <code>thread_id</code> = %d
ORDER BY <code>date_sent</code> DESC
LIMIT 0, 1
", $thread->thread_id ) );
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!
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…
Im not sure what is the way you are using it to suggest something else
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.
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.
Ok, great, good to know. Thank you!