function get_published_entries_table() { global $wpdb; // Store prefix separately to avoid direct "->" usage $prefix = $wpdb->prefix; $table_name = $prefix . 'fusion_forms_entries'; // Fetch entries where consent was given // $query = $wpdb->prepare("SELECT * FROM $table_name WHERE form_id = 1704 AND consent_field = %s", 'I consent to publication of my membership details to other members of //JAR-Association (optional)'); $query = $wpdb->prepare("SELECT * FROM $table_name WHERE form_id = 1704 ); $results = $wpdb->get_results($query); if (!$results) { return "

No records available for publication.

"; } // Start the table using Avada's "fusion-table" class for styling $output = ''; $output .= ''; foreach ($results as $entry) { $output .= ""; $output .= ""; $output .= ""; $output .= ""; } $output .= "
NameEmail
" . esc_html($entry->name) . "" . esc_html($entry->email) . "
"; return $output; } // Register shortcode for use in Avada pages add_shortcode('published_entries_table', 'get_published_entries_table');