Prefetch message meta when in a message loop.

This reduces overhead when querying for message meta in the context of a
bp_thread_has_messages() loop.

Also introduces an 'update_meta_cache' parameter to the bp_has_thread_messages()
stack, so the message meta cache prefetch can be disabled by developers.

See #3083.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9183 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Grab all message IDs before deleting a message thread.

In BP_Messages_Thread::delete(), we need to grab all message IDs before
a message thread is outright deleted.  This is done by using
$wpdb->get_col() instead of $wpdb->get_var().

This commit also:

* Deletes the message meta attached to the message (see #3083)
* Reinstates the 'messages_thread_deleted_hook' action that was improperly removed in r9165
* Adds $message_ids as an extra parameter to the 'bp_messages_thread_after_delete' action

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9184 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Introduce 'bp_messages_thread_before_mark_delete' action.

This commit renames the 'bp_messages_thread_before_delete' action added in
r9165 to 'bp_messages_thread_before_mark_delete' and moves the
'bp_messages_thread_before_delete' hook where the message thread is
actually deleted.

The phpDoc for BP_Messages_Thread::delete() is also updated to accurately
outline what is happening in the class method.

See #5193.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9185 cdf35c40-ae34-48e0-9cc9-0c9da1808c22