add_shortcode('ff_manager', function($atts){ global $wpdb; $atts = shortcode_atts([ 'form' => 1 ], $atts); $form_id = intval($atts['form']); $tabla = $wpdb->prefix . 'fluentform_submissions'; $rows = $wpdb->get_results(" SELECT id, response, created_at FROM $tabla WHERE form_id = $form_id ORDER BY id DESC "); if(!$rows){ return "

No hay registros.

"; } $html = ''; $html .= ' '; foreach($rows as $row){ $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; } $html .= "
ID Fecha Acción
{$row->id}{$row->created_at} Abrir
"; if(isset($_GET['entry_id'])){ $entry_id = intval($_GET['entry_id']); $entry = $wpdb->get_row(" SELECT response FROM $tabla WHERE id = $entry_id "); if($entry){ $datos = json_decode($entry->response, true); $html .= "
"; $html .= "

Datos del Registro #{$entry_id}

"; $html .= ""; foreach($datos as $campo=>$valor){ if(is_array($valor)){ $valor = implode(", ", $valor); } $html .= " "; } $html .= "
{$campo} {$valor}
"; } } return $html; });