better_messages_user_conversation
Embed a direct conversation between the current visitor and a specified user. If they've never messaged before, the thread is created automatically. If a thread already exists, that thread is displayed. Perfect for author bio pages, vendor profiles, coach landing pages, and any context where a user should land directly in conversation with a specific person.
When to use it#
| Use case | Pattern |
|---|---|
| Author bio "Message me" page | Auto-pull author from post context, embed DM thread |
| Marketplace vendor storefront | "Message vendor" page with their dedicated thread |
| Coaching / consulting landing page | Client lands directly in conversation with the coach |
| Telemedicine practitioner profile | Patient gets direct chat with their assigned practitioner |
| Support staff individual page | Direct DM with a specific support rep |
Attributes#
| Attribute | What it does | Default |
|---|---|---|
user_id | The user to start/show a conversation with | Author of the current WordPress post or page |
Usage#
[better_messages_user_conversation user_id="55"]
If user_id is omitted, the post/page author is used:
[better_messages_user_conversation]
Examples#
Coaching page#
[better_messages_user_conversation user_id="12"]
Embed on a coach's landing page (user ID 12 = the coach). Visitors land directly in a private conversation with the coach.
Marketplace vendor profile#
// In a vendor profile template:
$vendor_id = get_vendor_id_from_context();
echo do_shortcode('[better_messages_user_conversation user_id="' . $vendor_id . '"]');
Each vendor profile gets a per-vendor DM thread auto-created for new visitors.
Author bio (auto-detect)#
[better_messages_user_conversation]
When placed on a post or page, no user_id needed — the post author becomes the recipient. Great for author bio boxes that consistently behave across all posts.
Frequently asked questions#
What happens if the visitor isn't logged in?#
The shortcode shows a login form first. After login, the user is taken directly to the conversation with the specified user.
Does this create a new thread every time?#
No — if a thread already exists between the two users, that thread is reused. New thread only when no prior conversation exists.
Can guests use this shortcode?#
Only with guest chat enabled. Guests get a transient identity for the conversation.
What if the specified user_id doesn't exist?#
The shortcode shows a "user not found" notice. Always validate the user_id in dynamic shortcode usage.
Is there a way to prepopulate a message?#
Not in the default UI. To pre-post a message into the thread programmatically, call Better_Messages()->functions->new_message( [ 'sender_id' => …, 'recipients' => …, 'content' => … ] ) before rendering, or use a JS filter on the input.
See also#
- better_messages — full inbox layout
- better_messages_single_conversation — embed a specific existing thread
- better_messages_live_chat_button — button that starts a chat (lighter alternative)
- better_messages_pm_button — legacy "private message" button
- Group conversations — multi-user threads