How to display the booking button on the original page.
I tried using the code below, but the “recipient” field is required. is displayed.
echo ( new HivePress\Blocks\Message_Send_Form( ) )->render();
How to display the booking button on the original page.
I tried using the code below, but the “recipient” field is required. is displayed.
echo ( new HivePress\Blocks\Message_Send_Form( ) )->render();
Hi,
Your request is related to a premium product. Please add the license key to the account settings to access forums for your purchased products and get the Premium Support badge on your profile. If the support for your purchase has expired, please consider renewing it for assistance: Renew Support | HivePress
Sorry, it was a HivePress Messages Plugin, not a Bookings Plugin.
x Booking Button
︎ Message Button
How to display the Message button on the original page?
Should I create the topic again?
Sorry for the delay.
Yes, if you mean inserting this form into a custom page using PHP, then this form will not have hidden (yet required) field “recipient” pre-filled. On the listing and vendor pages, it’s pre-filled automatically. If you get the recipient user ID, you can try to pre-fill it this way:
echo ( new \HivePress\Forms\Message_Send( [ 'values' => [ 'recipient' => 123 ] ] ) )->render();
Hope this helps
thank you.
When I tried it, no data was passed to the recipient.
Change the following into the existing code worked for me.
Please let me know if there are any mistakes.
// Set recipient.
if (isset($this->args['values']['recipient'])) {
$this->values['recipient'] = $this->args['values']['recipient'];
}else {
$this->values['recipient'] = hivepress()->request->get_param( 'user_id' );
}
Thanks for sharing, the code seems to be ok, but if this change was made directly in the HivePress Messages files, then it may be erased on the plugin update.
Thank you for your kind response.