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 .= ' ID Fecha Acción '; foreach($rows as $row){ $html .= ""; $html .= "{$row->id}"; $html .= "{$row->created_at}"; $html .= " Abrir "; $html .= ""; } $html .= ""; 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 .= " {$campo} {$valor} "; } $html .= ""; } } return $html; });