create_conversation_link
This function is to generate url which points to new conversation screen or directly to conversation screen
REQUIREMENTS
To be able to implement this guide, you need to learn how to insert PHP snippets to your website.
You can find guide here: WP Beginner
Compatibility
This function compatible with Better Messages 2.0.60 or higher
New conversation screen
<?php
// User ID of member to create conversation with
$user_id = 3;
// Predefined subject for new conversation input field.
// Leave empty to not prefill
$subject = 'Conversation Subject';
// Predefined message for new conversation input field.
// Leave empty to not prefill
$message = 'Conversation Predefined Content';
$fastStart = false;
// Automatically scroll to messages container on page load
$scrollToContainer = true;
$url = Better_Messages()->functions->create_conversation_link( $user_id, $subject, $message, $fastStart, $scrollToContainer );
// Show link to write starting from new threads screen
echo '<a href="' . $url . '">Private Message</a>';
Opening the conversation directly
<?php
// User ID of member to create conversation with
$user_id = 3;
// Subject not works in this mode
$subject = '';
// Message not works in this mode
$message = '';
$fastStart = true;
// Automatically scroll to messages container on page load
$scrollToContainer = true;
$url = Better_Messages()->functions->create_conversation_link( $user_id, $subject, $message, $fastStart, $scrollToContainer );
// Show link which will direct directly to the conversation
echo '<a href="' . $url . '">Fast Private Message</a>';