Join our new community forum for support & discussion
Join NowHome › Support › Extensions › Messages › Custom fields not working
Custom fields not working
-
AuthorPosts
-
Nihal 1 year, 5 months ago
Hi, I added below code snippet to make custom message form. but ones user submit form only description field is visible to admin. Am I missing anything here?
Also is there any other place to check all messages in wordpress dashboard.
Code :add_filter( 'hivepress/v1/forms/message_send', function( $form ) { $form['fields']['name'] = [ 'type' => 'text', 'order' => 1, 'label' => 'Full Name', 'required' => true, ]; $form['fields']['contact'] = [ 'type' => 'number', 'order' => 1, 'label' => 'Contact Number', 'required' => true, 'max_length' => 12, ]; $form['fields']['location'] = [ 'type' => 'select', 'options' => ["location1" => "location1", "location2" => "location2", "location3" => "location3"], 'order' => 2, 'label' => 'Location', 'multiple' => false, 'required'=>true, ]; if (isset($form['fields']['text'])) { $form['fields']['text'] = [ 'label' => 'Additional Info', 'required' => false ]; } unset ( $form['fields']['attachment'] ); return $form; } );
Sorry, this requires further customizations – if you added some custom fields these should be also validated and saved for each message, and displayed somewhere (e.g. in the email content or the front-end templates). You can try this code snippet to display messages in the WordPress/Comments section https://hivepress.io/support/topic/showing-messages-in-comments-is-this-correct/
Nihal 1 year, 5 months agoHi, Thank you so much for reply. Can you please guide me file names where I can make changes for these fields to appear in mail. I dont mind if it does not get saved. If the fields comes in mail then thats more then enough
Thank you
Unfortunately there’s no simple code snippet for this, the email gets the message object so these new fields should be saved for each message. There may be another way, but I can’t say for sure without testing this further. If customizations beyond the available options are required for your site please list the requirements and we’ll try to estimate them https://hivepress.io/customization/
Nihal 1 year, 5 months agoIn that case can I add my own form (contact form 7) using short code or something. Or can I add new form below price on product page??
Sure, but it would require some basic integration anyway (e.g. to fetch the current vendor’s email). If you mean turning Messages into a contact form that doesn’t require user registration this would require some customizations (currently a user account is required).
Nihal 1 year, 5 months agoNo I just want to display contact 7 form on product listing page. I dont want email or any fields. All fields will be entered manually. How can I put that form on product page?
Thanks
Please try this PHP snippet:
add_filter( 'hivepress/v1/templates/listing_view_page', function( $template ) { return hivepress()->helper->merge_trees( $template, [ 'blocks' => [ 'page_content' => [ 'blocks' => [ 'listing_contact_form' => [ 'type' => 'content', 'content' => do_shortcode('[any_shortcode_here]'), ], ], ], ], ] ); } );
Nihal 1 year, 5 months agoSure. Ill try this and comment here if that works. Thanks a lot
Nihal 1 year, 5 months agoWorking great. thanks
-
AuthorPosts
New Reply
This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.