Everything seems to be working correctly, but I am unsure where the value entered in this new field is actually stored. Specifically, I would like to know:
In which database table/column is the phone number stored (or the value entered in the custom_text_field), and how can I view or manage it within HivePress?
If there is a more efficient or recommended method to add and store custom fields, such as a phone number, that would better integrate with HivePress’s message structure.
Thank you in advance for your support. I look forward to your response.
Yes, this is the correct way to add a new field and store it for messages. The second snippet for hivepress/v1/models/message/attributes is not needed, though. This new field is stored in wp_commentmeta database table (because message is a hidden comment type), with “hp_custom_text_field” meta key.
Another approach is adding a user attribute Phone and make it required, then it will be mandatory on registration. Since messages require registration anyway, you can collect the phone number once and then use it (for example) in the New Message email using %sender.phone% token.
As we understand it, the value to be entered will then be saved within the dedicated database. Using wordpress and siteground, the database can be accessed from phpmyadmin. I cannot find the table mentioned and the metakey. Could you please provide support regarding the navigation and display of the table?
Please check if there’s a table with “commentmeta” in its name. This is the default WordPress database table so it’s there for sure, but the default prefix “wp_” can differ. If you want to display the phone number somewhere in the message layout I can provide general guidance on how to do this, let me know.
Hi @ihor . I’m here exactly for the question asked by @partyplus.it. Can you please follow up and provide the guidance on how to actually get the new custom fields across to the recepient. My existing code in functions.php is like the following:
// Form modification filter
add_filter(‘hivepress/v1/forms/message_send’, function($form) {
if (‘messages_view_page’ === hivepress()->router->get_current_route_name()) {
return $form;
}
Upon sending the message, the recepient (in their messages space of their account) should see not just the message but also the additional fields. I read somewhere in one of your ‘questions’ page, customizing message_text.php in hivepress-messages is necessary. No clear guidance was given there and my attempts didn’t work. I hope this time, I’ll get the answer.
Hi @condorito.fr. Thank you for sharing. Forgive me if I’m missing something here. What I would like is for the front end form values (in the code snippet above) on message to be sent to the recepient. Currently, despite those form fields, the recepient receives only the message.
I believe message_text.php in hivepress-messages handles this. This is the default code in it. Help is much appreciated!
Thank you for the response @condorito.fr. The message form (as in the attached image) takes in subject, message text and attachment. But the recipient receives only the latter two. My wish is for the recipient to receive the subject including the message text and attachment. Everything that’s part of the form.
Please see the attached images as an example for the message form on the front end and the message the recipient sees.