lifterlms icon indicating copy to clipboard operation
lifterlms copied to clipboard

Error in exporting the user report

Open saracomin96 opened this issue 1 year ago • 7 comments

Reproduction Steps

I have about 300 users, when I try to export the export, after an infinite loading, it gives me this error: An error was encountered during export:

instead if I have about 80 users (therefore filtering by courses), it doesn't give me this problem

Expected Behavior

It should download the report correctly instead it does nothing in addition to the user default fields I also added the costum fields that I created with lifterlms and I changed the separetor from ',' to ';'

Actual Behavior

No reports downloaded

Error Messages / Logs

  • Include any relevant error messages or log files
Failed to load resource: the server responded with a status of 502 () /wp-admin/admin-ajax.php:1

llms-admin-tables.js:172 
Object
abort
: 
ƒ (e)
always
: 
ƒ ()
catch
: 
ƒ (e)
complete
: 
ƒ ()
done
: 
ƒ ()
error
: 
ƒ ()
fail
: 
ƒ ()
getAllResponseHeaders
: 
ƒ ()
getResponseHeader
: 
ƒ (e)
overrideMimeType
: 
ƒ (e)
pipe
: 
ƒ ()
progress
: 
ƒ ()
promise
: 
ƒ (e)
readyState
: 
4
responseText
: 
"<!DOCTYPE html>\n<html>\n<head>\n    <title>Error Loading Site | 502 Bad Gateway</title>\n</head>\n\n<body>\n    <style>\n@import url(//fonts.googleapis.com/css?family=Open+Sans:300);\n\n    body {\n    color: #343434;\n    font-family: 'Open Sans Regular', Helvetica, Arial, sans-serif;\n    font-size: 16px;\n    font-weight: 300;\n    line-height: 1.2;\n    margin: 50px 25px;\n    }\n\n    h1,h2,h3,h4,h5,h6 {\n    font-weight:300;\n    margin:5px 0 25px;\n    padding:0;\n    }\n\n    h1 {\n    font-size: 100px;\n    margin:5px -5px 10px 0;\n    }\n\n    hr {\n    background:#DFDFDF;\n    height: 1px;\n    border:0;\n    margin: 40px 0 30px;\n    }\n\n    </style>\n\n    <h1>502</h1>\n\n    <h2>The page request was canceled because it took too long to complete</h2>\n    <hr>\n\n    <p><strong>What can I do?</strong></p>\n\n    <p></p>\n\n    <p><strong>Site visitors:</strong> There was an issue serving your request,\n    please try again in a few minutes.</p>\n\n    <p><strong>Site Owners:</strong> A request for either a page, script,\n    process, or query has taken too long to complete and has been cancelled due\n    to a bad gateway. You should visit your error log for more information.</p>\n</body>\n</html>"
setRequestHeader
: 
ƒ (e,t)
state
: 
ƒ ()
status
: 
502
statusCode
: 
ƒ (e)
statusText
: 
"error"
success
: 
ƒ ()
then
: 
ƒ (t,n,r)
[[Prototype]]
: 
Object

System and Environment Information

System Report
Wordpress
-------------------------------------------

Home Url: https://academy.bluenext.it
Site Url: https://academy.bluenext.it
Login Url: https://academy.bluenext.it/wp-login.php
Version: 6.0.2
Debug Mode: No
Debug Log: No
Debug Display: Yes
Locale: it_IT
Multisite: No
Page For Posts: Not Set
Page On Front: Home Page (#1372) [https://academy.bluenext.it/]
Permalink Structure: /%postname%/
Show On Front: page
Wp Cron: Yes


Settings
-------------------------------------------

Version: 6.10.1
Db Version: 6.10.1
Course Catalog: Catalogo Corsi (#16) [https://academy.bluenext.it/?page_id=16]
Membership Catalog: Catalogo Membership (#17) [https://academy.bluenext.it/?page_id=17]
Student Dashboard: Area Riservata (#1317) [https://academy.bluenext.it/area-riservata/]
Checkout Page: Acquisti (#18) [https://academy.bluenext.it/purchase/]
Course Catalog Per Page: 9
Course Catalog Sorting: menu_order
Membership Catalog Per Page: 9
Membership Catalog Sorting: menu_order
Site Membership: Not Set
Courses Endpoint: my-courses
Edit Endpoint: modifica-account
Lost Password Endpoint: lost-password
Vouchers Endpoint: riscatta-voucher
Autogenerate Username: no
Password Strength Meter: no
Minimum Password Strength: 
Terms Required: no
Terms Page: Not Set
Checkout Names: 
Checkout Address: 
Checkout Phone: 
Checkout Email Confirmation: no
Open Registration: no
Registration Names: 
Registration Address: 
Registration Phone: 
Registration Voucher: 
Registration Email Confirmation: no
Account Names: 
Account Address: 
Account Phone: 
Account Email Confirmation: no
Confirmation Endpoint: confirm-payment
Force Ssl Checkout: no
Country: IT
Currency: EUR
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Decimals: 2
Trim Zero Decimals: no
Recurring Payments: yes
Email From Address: [email protected]
Email From Name: Bluenext Academy
Email Footer Text: 
Email Header Image: 
Cert Bg Width: 800
Cert Bg Height: 616
Cert Legacy Compat: no


Constants
-------------------------------------------

LLMS_REMOVE_ALL_DATA: undefined
LLMS_REST_DISABLE: undefined
LLMS_SITE_FEATURE_RECURRING_PAYMENTS: undefined
LLMS_SITE_IS_CLONE: undefined


Gateways
-------------------------------------------

Stripe: Enabled
Stripe Test Mode: Disabled
Stripe Logging: no
Stripe Order: 1
Manuale: Disabled
Manuale Logging: no
Manuale Order: 1


Server
-------------------------------------------

Mysql Version: 5.7.39
Php Curl: Yes
Php Default Timezone: UTC
Php Fsockopen: Yes
Php Max Input Vars: 10000
Php Max Upload Size: 50 MB
Php Memory Limit: 512M
Php Post Max Size: 100M
Php Soap: Yes
Php Suhosin: No
Php Time Limt: 3600
Php Version: 7.4.28
Software: Apache
Wp Memory Limit: 40M


Browser
-------------------------------------------

HTTP USER AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36


Theme
-------------------------------------------

Name: LifterLMS LaunchPad Child
Version: 1.1.0
Themeuri: https://lifterlms.com/product/launchpad/
Authoruri: https://lifterlms.com
Template: lifterlms-launchpad
Child Theme: Yes
Llms Support: No


Plugins
-------------------------------------------

Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control: 4.1.1
Elementor: 3.7.4
Elementor Pro: 3.7.5
Events Widgets For Elementor And The Events Calendar: 1.5.2
FluentCRM - Marketing Automation For WordPress: 2.5.95
Genesis Blocks: 1.5.1
LifterLMS: 6.10.1
LifterLMS Blocks: 2.4.3
LifterLMS Custom Fields: 2.0.2
LifterLMS Labs: 1.6.0
LifterLMS Stripe Payment Gateway: 5.4.0
Login as User: 1.4.4
PublishPress Capabilities: 2.5.1
Simple Custom CSS and JS: 3.40
The Events Calendar: 6.0.0.1
Toolset Blocks: 1.6.3
Toolset Module Manager: 1.8.8
Toolset Types: 3.4.16
WP All Import: 3.6.8
WP Engine Smart Plugin Manager: 5.12.8
WPForms: 1.7.6
WPForms Stripe: 2.6.1
WPForms User Registration: 2.1.0
WP Mail Logging: 1.10.4
WP Mail SMTP: 3.5.2
Yoast Duplicate Post: 4.5
Yoast SEO: 19.6.1


Integrations
-------------------------------------------

BbPress: No
BuddyPress: No


Template Overrides
-------------------------------------------

content-certificate.php (ver: 6.0.0): /nas/content/live/bluenext/wp-content/themes/lifterlms-launchpad-child-trunk//lifterlms/ (ver: 4.21.0)
checkout/form-checkout.php (ver: 5.0.0): /nas/content/live/bluenext/wp-content/themes/lifterlms-launchpad-child-trunk//lifterlms/ (ver: 5.0.0)
emails/header.php (ver: 3.16.15): /nas/content/live/bluenext/wp-content/themes/lifterlms-launchpad-child-trunk//lifterlms/ (ver: 3.16.15)



This issue has be recreated:

  • [x] Locally
  • [x] On a staging site
  • [x] On a production website
  • [ ] With only LifterLMS and a default theme

Browser, Device, and Operating System Information

  • Browser name and version
  • Operating System name and version
  • Device name and version (if applicable)

saracomin96 avatar Sep 14 '22 07:09 saracomin96

hey @saracomin96

The provided errors is a JS error encountered when the server encounters an error returning the data via AJAX request.

The error here is a 502 gateway error which is usually a result of server resource exhaustion.

There are a number of causes to an error like this... there's two variables we can focus on immediately:

  1. You noted that you have custom code on the tables, are these custom columns exportable? If so, are these errors occurring when you disable your custom columns?

  2. What kind of server are you running? It's possible that as your site has grown it is outgrowing your server. LifterLMS is a necessarily resource-intensive plugin, especially with regards to reporting data. Reporting calculations take a lot of queries and are expensive to process. We perform these calculations in the background but if your server is a "bargain" server even with 100 students you might start to see issues with some of these queries and calculations.

Finally, since this is a server-side error, any server logs you can provide with additional error information would be exceedingly helpful. Right now we know it's a 502 error but there might be more in your apache/nginx/php logs that might help us find a solution.

thomasplevy avatar Sep 14 '22 15:09 thomasplevy

hi, i try to delete the extra fields in the export table and i managed to export the csv correctly I fetch the rest of the information and update you!

saracomin96 avatar Sep 15 '22 10:09 saracomin96

@saracomin96

If the 502 error is not happening when you remove your custom code then the custom code is likely causing the error.

If you'd like some help debugging this code to see what's creating a 502 error please post the relevant code here and we can have a closer look at it and make some suggestions for you.

thomasplevy avatar Sep 15 '22 15:09 thomasplevy

Hi, this is the code

        add_filter( "llms_table_get_data_students", function( $value, $key,  $student, $context, $table) {
	
      $course_id = $table->get_filter(); // if this is empty there"s no filter being applied currently.
    //$crediti = get_user_meta( $student->id, "credits_".$course_id."" );

	$course_amount = $student->get_enrollment_order( $course_id )->total;

	$couponcode = $student->get_enrollment_order( $course_id )->coupon_code;

	$status = $student->get_enrollment_order( $course_id )->status;

	$ordine_appartenenza = $student->ordine_appartenenza;

	$pec_codice_sdi = $student->text_13_84;

	$partita_iva = $student->text_13_52;

	$denominazione_sociale = $student->text_13_22;

	$crediti_formativi = $student->crediti_formativi;

	$num_iscrizione_ordine = $student->iscrizione_ordine;

	$codice_fiscale = $student->codice_fiscale;

    $albos = $student->albo;

    $praticante_commercialistas = $student->praticante_DottoriCommercialistiedEspertiContabili;
    $ordine_commercialista = $student->ordine_DottoriCommercialistiedEspertiContabili;
    $altro_commercialista = $student->altro_ordine_DottoriCommercialistiedEspertiContabili;
    $n_ordine_commercialista = $student->n_iscrizione_DottoriCommercialistiedEspertiContabili;

    $praticante_consulentes = $student->praticante_ConsulentidelLavoro;
    $ordine_consulente = $student->ordine_ConsulentidelLavoro;
    $altro_consulente = $student->altro_ordine_ConsulentidelLavoro;
    $n_ordine_consulente = $student->n_iscrizione_ConsulentiDelLavoro;    

    $praticante_avvocatos = $student->praticante_Avvocati;
    $ordine_avvocato = $student->ordine_Avvocati;
    $altro_avvocato = $student->altro_ordine_Avvocati;
    $n_ordine_avvocato = $student->n_iscrizione_Avvocati;       

    $praticante_revisores = $student->praticante_RevisoriLegali;
    $n_ordine_revisore = $student->n_iscrizione_RevisoriLegali; 

    $modalita = "modalita_".$course_id;
    $modalita_partecipazione = get_user_meta($student->get_id(), $modalita, true);


//commercialista
if ( "ordine_commercialista" === $key ) {

    if ($ordine_commercialista != "") {
$value = $ordine_commercialista;

   } else {

$value = "";

   }

}	

if ( "praticante_commercialista" === $key ) {

    if ($praticante_commercialistas != "") {

    	foreach ($praticante_commercialistas as $praticante_commercialista) {
            $praticante_commercialistaArray[] = $praticante_commercialista;
        }
        $value =  implode(", ", $praticante_commercialistaArray);    	

   } else {
$value = "";
   }

}	


if ( "altro_commercialista" === $key ) {

    if ($altro_commercialista != "") {
$value = $altro_commercialista;

   } else {
$value = "";
   }

}	

if ( "n_iscrizione_commercialista" === $key ) {

    if ($n_ordine_commercialista != "") {
$value = $n_ordine_commercialista;

   } else {
$value = "";
   }

}

//consulente
if ( "ordine_consulente" === $key ) {

    if ($ordine_consulente != "") {
$value = $ordine_consulente;

   } else {
$value = "";
   }

}	

if ( "praticante_consulente" === $key ) {

    if ($praticante_consulentes != "") {

    	foreach ($praticante_consulentes as $praticante_consulente) {
            $praticante_consulenteArray[] = $praticante_consulente;
        }
        $value =  implode(", ", $praticante_consulenteArray);  

   } else {
$value = "";
   }

}	


if ( "altro_consulente" === $key ) {

    if ($altro_consulente != "") {
$value = $altro_consulente;

   } else {
$value = "";
   }

}	

if ( "n_iscrizione_consulente" === $key ) {

    if ($n_ordine_consulente != "") {
$value = $n_ordine_consulente;

   } else {
$value = "";
   }

}


//avvocato
if ( "ordine_avvocato" === $key ) {

    if ($ordine_avvocato != "") {
$value = $ordine_avvocato;

   } else {
$value = "";
   }

}	

if ( "praticante_avvocato" === $key ) {

    if ($praticante_avvocatos != "") {
    	foreach ($praticante_avvocatos as $praticante_avvocato) {
            $praticante_avvocatoArray[] = $praticante_avvocato;
        }
        $value =  implode(", ", $praticante_avvocatoArray);  
   } else {
$value = "";
   }

}	


if ( "altro_avvocato" === $key ) {

    if ($altro_avvocato != "") {
$value = $altro_avvocato;

   } else {
$value = "";
   }

}	

if ( "n_iscrizione_avvocato" === $key ) {

    if ($n_ordine_avvocato != "") {
$value = $n_ordine_avvocato;

   } else {
$value = "";
   }

}


//revisore
if ( "praticante_revisore" === $key ) {

    if ($praticante_revisores != "") {

    	foreach ($praticante_revisores as $praticante_revisore) {
            $praticante_revisoreArray[] = $praticante_revisore;
        }
        $value =  implode(", ", $praticante_revisoreArray); 

   } else {
$value = "";
   }

}	

	

if ( "n_iscrizione_revisore" === $key ) {

    if ($n_ordine_revisore != "") {
$value = $n_ordine_revisore;
   } else {
$value = "";
   }

}	





if ($albos != "") {

    foreach ($albos as $albo) {
    	


      if ($albo == "Dottori Commercialisti ed Esperti Contabili") {
       if ( "crediti_commercialisti" === $key ) {

        //$albo_name = str_replace(" ","", $albo); 
        $crediti = "credits_".$course_id."_DottoriCommercialistiedEspertiContabili";  
        $crediti_maturati = get_user_meta($student->get_id(), $crediti, true);

   
     $value = $crediti_maturati;   

        } 

      }     


    elseif ($albo == "Avvocati") {
      if ( "crediti_avvocati" === $key ) {
  
        //$albo_name = str_replace(" ","", $albo); 
        $crediti = "credits_".$course_id."_Avvocati";  
        $crediti_maturati = get_user_meta($student->get_id(), $crediti, true);
        $value = $crediti_maturati;

        } 
       
      }        

    elseif ($albo == "Consulenti del Lavoro") {
        if ( "crediti_consulenti" === $key ) {

        //$albo_name = str_replace(" ","", $albo); 
        $crediti = "credits_".$course_id."_ConsulentidelLavoro";  
        $crediti_maturati = get_user_meta($student->get_id(), $crediti, true);
        $value = $crediti_maturati;

        } 
       
      }




    elseif ($albo == "Revisori Legali") {
        if ( "crediti_revisori" === $key ) {
    	//$albo_name = str_replace(" ","", $albo); 
    	$crediti = "credits_".$course_id."_RevisoriLegali";  
        $crediti_maturati = get_user_meta($student->get_id(), $crediti, true);


		$value = $crediti_maturati;
    	} 
     
      } 


    }


} else {

if ( "crediti_commercialisti" === $key ) { 
$value = "";
} 

if ( "crediti_consulenti" === $key ) { 
$value = "";
} 

if ( "crediti_avvocati" === $key ) { 
$value = "";
} 

if ( "crediti_revisori" === $key ) { 
$value = "";
}  

}



 if("modalita_partecipazione" === $key) {
    if($modalita_partecipazione != "") {	
    	$value = $modalita_partecipazione;
    } else {
    	$value = "";
    }

}

	
    if ( "num_iscrizione_ordine" === $key ) {
    	if($num_iscrizione_ordine != "") {
    	$value = $num_iscrizione_ordine;	
    } else {
    	$value = "";
    }
		
	}

    if ( "codice_fiscale" === $key ) {
		$value = $codice_fiscale;
	}

    if ( "crediti_formativi" === $key ) {
		$value = $crediti_formativi;
	}


    if ( "denominazione_sociale" === $key ) {
		$value = $denominazione_sociale;
	}

    if ( "partita_iva" === $key ) {
		$value = $partita_iva;
	}	

    if ( "pec_codice_sdi" === $key ) {
		$value = $pec_codice_sdi;
	}	
    

    if ( "ordine_appartenenza" === $key ) {
		

		if($ordine_appartenenza != "") {
        $value = $ordine_appartenenza;
		} else {
			$value = "";
		}
	}


	if ( "amount_total" === $key ) {

      $value = $course_amount;
    }  


    if ( "coupon_user" === $key ) {

      $value = $couponcode;
    } 

    if ( "refound_user" === $key ) {
       if ($status == "llms-refunded"){
        $value = "SI"; 
       } else {
         $value = "NO";
       }
 	       	       
    }

    if ( "refound_amount" === $key ) {

    if ( $status == "llms-refunded") {
           $value = $course_amount; 
 	  }  else  {
 	  	  $value = "";
 	  }
    } 

    if("albo_elenco" === $key) {
    	if($albo != "") {

    	foreach ($albos as $albo) {
            $albosArray[] = $albo;
        }
        $value =  implode(", ", $albosArray);	
    	} else {
    		$value = "";
    	}

    } 	  

	return $value;



}, 10, 5 );


function my_students_table_columns( $cols ) {


    $cols["ordine_commercialista"] = array(
        "title" => __( "Ordine commercialista", "lifterlms-ordine-commercialista" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["altro_commercialista"] = array(
        "title" => __( "Altro ordine commercialista", "lifterlms-altro-ordine-commercialista" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["n_iscrizione_commercialista"] = array(
        "title" => __( "N° iscrizione commercialista", "lifterlms-n-ordine-commercialista" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["praticante_commercialista"] = array(
        "title" => __( "Praticante commercialista", "lifterlms-praticante-ordine-commercialista" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );


    $cols["ordine_consulente"] = array(
        "title" => __( "Ordine consulente", "lifterlms-ordine-consulente" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["altro_consulente"] = array(
        "title" => __( "Altro ordine consulente", "lifterlms-altro-ordine-consulente" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["n_iscrizione_consulente"] = array(
        "title" => __( "N° iscrizione consulente", "lifterlms-n-ordine-consulente" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["praticante_consulente"] = array(
        "title" => __( "Praticante consulente", "lifterlms-praticante-ordine-consulente" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );


    $cols["ordine_avvocato"] = array(
        "title" => __( "Ordine avvocato", "lifterlms-ordine-avvocato" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["altro_avvocato"] = array(
        "title" => __( "Altro ordine avvocato", "lifterlms-altro-ordine-avvocato" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["n_iscrizione_avvocato"] = array(
        "title" => __( "N° iscrizione avvocato", "lifterlms-n-ordine-avvocato" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["praticante_avvocato"] = array(
        "title" => __( "Praticante avvocato", "lifterlms-praticante-ordine-avvocato" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );    



    $cols["n_iscrizione_revisore"] = array(
        "title" => __( "N° iscrizione revisore", "lifterlms-n-ordine-revisore" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["praticante_revisore"] = array(
        "title" => __( "Praticante revisore", "lifterlms-praticante-ordine-revisore" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    ); 


    $cols["modalita_partecipazione"] = array(
        "title" => __( "Modalita Partecipazione", "lifterlms-modalita-partecipazione" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );

    $cols["albo_elenco"] = array(
        "title" => __( "Albo", "lifterlms-albo" ),
        "export_only" => false, // set to false to show display screens but include in exports
        "exportable" => true, // set to false to exclude from exports
    );


	$cols["crediti_commercialisti"] = array(
		"title" => __( "Crediti Commercialista", "lifterlms-crediti-commercialisti" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["crediti_revisori"] = array(
		"title" => __( "Crediti Revisori Legali", "lifterlms-crediti-revisori" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["crediti_avvocati"] = array(
		"title" => __( "Crediti Avvocati", "lifterlms-crediti-avvocati" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);



	$cols["crediti_consulenti"] = array(
		"title" => __( "Crediti Consulente del lavoro", "lifterlms-crediti-consulenti" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["codice_fiscale"] = array(
		"title" => __( "Codice Fiscale", "lifterlms-codice-fiscale" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);

	$cols["num_iscrizione_ordine"] = array(
		"title" => __( "Num iscrizione Ordine", "lifterlms-num-iscrizione-ordine" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);

	$cols["crediti_formativi"] = array(
		"title" => __( "Crediti formativi", "lifterlms-crediti-formativi" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);

	$cols["denominazione_sociale"] = array(
		"title" => __( "Denominazione Sociale", "lifterlms-denominazione-sociale" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);

	$cols["partita_iva"] = array(
		"title" => __( "Partitva IVA", "lifterlms-partita-iva" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["pec_codice_sdi"] = array(
		"title" => __( "PEC o Codice SDI", "lifterlms-pec-codice-sdi" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["ordine_appartenenza"] = array(
		"title" => __( "Ordine di appartenenza", "lifterlms-ordine-appartenenza" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);

	$cols["amount_total"] = array(
		"title" => __( "Amount Paid", "lifterlms-price" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["coupon_user"] = array(
		"title" => __( "Discount Code", "lifterlms-coupon" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);


	$cols["refound_amount"] = array(
		"title" => __( "Refound Amount", "lifterlms-refound_amount" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);    
   
	$cols["refound_user"] = array(
		"title" => __( "Iscrizione annullata", "lifterlms-annullata" ),
		"export_only" => false, // set to false to show display screens but include in exports
		"exportable" => true, // set to false to exclude from exports
	);	

	return $cols;
   

 }
add_filter( "llms_table_get_students_columns", "my_students_table_columns", 10 );




add_filter( "llms_student_query_parse_args", function( $args ) {

    $page    = $_REQUEST["page"] ?? null;
    $action  = $_REQUEST["action"] ?? null;
    $handler = $_REQUEST["handler"] ?? null;
    
    // Only run this query on the main student reporting table.
    // First condition happens on the reporting first page load, second is on async fetches when paginating the table.
    if ( "llms-reporting" === $page || ( "get_admin_table_data" === $action && "Students" === $handler ) ) {
        $args["statuses"] = array_keys( llms_get_enrollment_statuses() );
    }

    return $args;

}, 10 );

saracomin96 avatar Sep 15 '22 22:09 saracomin96

Since I needed to generate a table to export with this data, I created it costum in a separate temporary page for the moment. I also created a page to load a csv and update the data of a list of users (including the completion of the lessons, use llms_mark_complete and update a meta data). I did everything through php without using ajax calls and rightly with a high number of users in the csv list it gives me error 502 (obviously). do you have any advice on how to do ajax calls?

saracomin96 avatar Sep 15 '22 22:09 saracomin96

@saracomin96 I'm having a hard time reading this exactly but it looks like you are adding 31 columns to an already large report... It doesn't look like anything you're doing should be too tremendously "heavy" though... but this might just be a problem of server resources given what you're trying to accomplish here... You might need a larger server with my CPU in order to build reports of this size... Data is expensive and the more data you require the more you need to consider how much resource is available to you.

If you can provide more details on what's happening on the server when the 502 error is encountered (what database queries are being run, how much CPU is available on the server, etc...) that might help us figure out what's going on here.

At the moment it looks to me like you've added custom code that's broken your site though...

Maybe adding all of this data on a new screen as you've said instead of bundling it into an existing report might be the best bet...

I'm not sure what else to advise since you've said the report itself is working without your custom code.

thomasplevy avatar Sep 16 '22 17:09 thomasplevy

@saracomin96 any thoughts on the above? We can leave this open if you'd like to discuss further otherwise I'll close it during our next triage if we don't hear back from you.

thomasplevy avatar Sep 22 '22 18:09 thomasplevy

@saracomin96 going to mark this as resolved. If you'd like to follow up just reply and we'll reopen.

thomasplevy avatar Oct 17 '22 19:10 thomasplevy