File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 30
30
* @since 1.8.7
31
31
*/
32
32
//set the number of users we'll load to try and protect ourselves from OOM errors
33
- $ max_users_per_loop = apply_filters ('pmpro_set_max_user_per_export_loop ' , 2000 );
33
+ $ max_users_per_loop = intval ( apply_filters ( 'pmpro_set_max_user_per_export_loop ' , 2000 ) );
34
34
35
+ //If the filter returns odd value, reset to default.
36
+ if ( $ max_users_per_loop < 1 ) {
37
+ $ max_users_per_loop = 2000 ;
38
+ }
35
39
global $ wpdb ;
36
40
37
41
//get users (search input field)
309
313
310
314
$ start = current_time ('timestamp ' );
311
315
312
- // Get the last record to output, will depend on which iteration we're on.
313
- if ( $ ic != $ iterations ) {
314
- $ i_end = ($ i_start + ( $ max_users_per_loop - 1 ));
315
- } else {
316
- // Final iteration, so last UID is the last record in the users array
317
- $ i_end = ($ users_found - 1 );
318
- }
319
- $ spl = array_slice ($ theusers , $ i_start , $ i_end + 1 );
316
+ $ i_end = min ( $ i_start + $ max_users_per_loop - 1 , $ users_found - 1 );
317
+
318
+ $ spl = array_slice ( $ theusers , $ i_start , $ i_end - $ i_start + 1 );
320
319
//increment starting position
321
- $ i_start + = $ max_users_per_loop ;
320
+ $ i_start = $ i_end + 1 ;
322
321
323
322
//escape the % for LIKE comparison with $wpdb
324
323
if (!empty ($ search ))
You can’t perform that action at this time.
0 commit comments