Update reports.php

This commit is contained in:
Paul Kevan 2024-05-23 15:11:32 +01:00 committed by GitHub
parent 83ef61b2f1
commit 2f8e6de56e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,8 +56,9 @@ function enqueue_assets() {
*/
function render_company_report_page() {
$status = sanitize_title( $_GET['status'] );
$status = sanitize_title( $_GET['status'] );
$pledge_limit = 500;
if ( ! in_array( $status, array( 'draft', '5ftf-deactivated', 'publish' ) ) ) {
$status = 'all';
}
@ -65,13 +66,13 @@ function render_company_report_page() {
$pledges = get_posts( array(
'post_type' => '5ftf_pledge',
'post_status' => $status,
'posts_per_page' => 500, // set to 500 to avoid unexpected memory overuse.
'posts_per_page' => $pledge_limit, // set to avoid unexpected memory overuse.
'orderby' => 'post_title',
'order' => 'ASC',
) );
// Add visible warning on page if we hit the upper limit of the query.
if ( 250 == count( $pledges ) ) {
if ( $pledge_limit === count( $pledges ) ) {
echo '<p>WARNING: pledge limit reached, check the code query.</p>';
}
?>