Support Forum
Support › MB Frontend Submission › Form don't showResolved
Hi.. I just installed a fresh WP Installation, with only MB plugins (MB and FrontEnd) and a plugin that create a Custom Type. Here below is the shortcode typed, with the code used to create the custom type. The problem is : the frontend doesn't display.
shortocde :
[mb_frontend_form id="vxp_contacts_data" post_fields="title"]
code for custom Type and metabox :
Hi Pascal,
I answered you via email. Posting here in case anyone needs it:
I see you're using the old syntax of Meta Box to register meta boxes. I've made the change to this: https://ghostbin.com/paste/d2k7b
Please try it.
Note that the way to register directly via class RW_Meta_Box
is not supported anymore. While it might work in normal cases, it's not compatible with other extensions. Please see the docs here: https://docs.metabox.io/creating-meta-boxes/
Let me know if you see any bug.
Hi I have my meta boxes working in the back end with all my custom fields. But I just bought the front end submissions plugin and have written my code below. The problem is it just echo's the string onto the page and doesn't put out the front end form. The code is giving me all the right fields in the admin end of wordpress. But trying to use it in the front end, it just echo's the string. And I have added my license key to the updater.
My php Shortcode
<?php
$form = '[mb_frontend_form id="deposit_price"]';
echo do_shortcode( $form );
?>
My php Meta Box Code
function add_meta_fields( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'deposit_price',
'title' => 'Finance' ,
'post_types' => array('rentals'),
'context' => 'normal',
'autosave' => false,
'fields' => array(
array(
'id' => 'deposit_price_field',
'type' => 'number',
'name' => 'Deposit',
'placeholder' => 'Just the number : 123456',
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'add_meta_fields' );
Hi Garth John,
Did you activate both Meta Box and MB Frontend Submission plugins together?
Yeah I activated them together. I saw the MB Icon only shows if you have both activated at the same time. I have also added the updater plugin to input my activation code.
Hi Garth John,
Do you have any condition when registering the meta boxes? Something like is_admin()
. Or you have some condition when load the PHP file that contains the meta boxes code. The MB Frontend Submission only works if the meta boxes registered on both front end and back end.
Hi Anh Tran
I don't have any is_admin() conditions written into my code. I haven't needed it. However. I'm not sure about the forms been registered on both front end and back end.
How can I check this?
Currently my forms work in the back end but not the front end. So I'm wandering if maybe it's because I haven't registered my form for the front end.
Also another thing I noticed is that I purchased the front end submissions extension. But then I see you guys have packages for core, developer and lifetime. I only purchased the front end submissions extension though. Is this right? I only need the front end submissions extension I don't need the others.
Thank you for the help.
Hi Garth,
To check if the meta box is registered only for admin, please check the PHP file that has the meta box code. You might want to check something similar to this:
add_action( 'admin_init', 'your_function' );
function your_function() {
add_filter( 'rwmb_meta_boxes', 'your_meta_boxes' );
}
// Or
if ( is_admin() ) {
include 'your-meta-boxes.php';
}
Regarding the purchase: yes, you only need the Frontend Submission extension.
This is how I've written my code for the meta boxes. with each $meta_boxes[] = array() adding a field to whichever post I have set it to. I have added many fields so I just took the start and finish of the code with one of the items I have added.
<?php
function add_meta_fields( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'area',
'title' => 'Area' ,
'post_types' => array( 'for_sale',' ' ),
'context' => 'normal',
'autosave' => false,
'fields' => array(
array(
'id' => 'address',
'name' => 'Address',
'type' => 'text',
),
array(
'id' => 'map',
'name' => 'Location',
'type' => 'map',
// Default location: 'latitude,longitude[,zoom]' (zoom is optional)
'std' => '-6.233406,-35.049906,15',
// Address field ID
'address_field' => 'address',
// Google API key
'api_key' => 'MY_API_KEY_IS_INSERTED_HERE',
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'add_meta_fields' );
?>
This is how I am calling my form with the shortcode. [mb_frontend_form id="area"]
How did you call the shortcode? Did you put it in post content or text widget?
If you call with PHP like
echo '[mb_frontend_form id="area"]';
Then it doesn't work. The correct code is:
echo do_shortcode( '[mb_frontend_form id="area"]' );
@Anh Tran
So this is what I have in my PHP file.
echo do_shortcode( '[mb_frontend_form id="area"]' );
and this is what I am getting back from that on the Front end.
The PHP echoes the shortcode as a string and no form is been displayed.
echo '[mb_frontend_form id="area"]';
Can you send me a temporary admin account via contact form? I'll check that more closer.
Hi I'm not gonna make an admin account for you the site is confidential at the moment so I'm not allowed to I have an NDA with the Client until the site is Launched.
But I can send through images of my code and debug the process however you advise. I have my plugin active with the meta box builder which I got when I purchased the frontend Submissions extension. I also have the updater plugin which I had to add so I could enter my API key.
I am using the HTML5_Blank theme. I'm not sure if maybe this could be part of the problem.
My console is also clean. I have no errors on my site.
I have also run all my code through this PHP Checker ( https://phpcodechecker.com/ ) and I have no errors. Also my forms are appearing in the back end for my custom posts I have registered and they are posting to the Database. Which means my code is working.
It is just the front end submissions shortcode that is not working.
I am a senior PHP developer. So feel free to use technical terms if that helps. I have control of the domain on the server as well. So if you need me to maybe adjust the memory limit or adjust something I can do that too.
Hi Garth, can you take a video record of the admin / or code, where you setup the meta box and how you insert it in your template?