How can I display a specific page or table on another custom page (custom dashboard).
In this case, it’s Form Submissions in Bricks Builder…
I created a FORM from which the data is stored into From Submissions.
I would like to display only this table from Form Submissions on another page (custom dashboard), which will be customized for a specific client.
What would be the easiest way to achieve this?
Can I design my own “table” and call the “ID” field from the Form Submissions page.
I want to query form submissions and their data on my website for a dashboard.
Maybe it can be used from the query loop. If not then Hopefully this will be a future feature.
Hey @timmse have you seen this question? Are you aware if there is a way to achvie this? I am also in the need of the functionality. Thanks in advance! You Rock!
Hi guys,
Unfortunately, that’s impossible with the query loop (since the form submissions aren’t a WP post type). Please add it as an idea to the idea board: Idea board – Bricks
However, you can query the form submissions with a custom SQL query like this in a code element, which should give you at least a starting point. Thanks to chatGPT for providing me with 99% of the code
<?php
global $wpdb;
// Table name with the correct prefix
$table_name = $wpdb->prefix . 'bricks_form_submissions'; // This ensures it uses the right prefix.
// Sample query: Get all rows from the table
$query = "SELECT * FROM $table_name";
// Execute the query
$results = $wpdb->get_results($query, ARRAY_A); // ARRAY_A returns the result as an associative array.
// Check if the query returned any results
if ( !empty($results) ) {
// Process your results
foreach ( $results as $row ) {
echo 'Form ID: ' . $row['form_id'] . ' / ';
echo 'Submission Date: ' . $row['created_at'] . ' / ';
// Decode the form data JSON string into a PHP associative array
$data = json_decode($row['form_data'], true);
// Loop through the first-level keys to get the dynamic key (like c8502d)
foreach ($data as $key => $inner_array) {
// Check if the 'value' exists in the inner array
if (isset($inner_array['value'])) {
$value = $inner_array['value'];
echo 'Value: ' . $value . '<br>';
}
}
// Add more fields as needed
}
} else {
echo 'No form submissions found.';
}
?>