BricksMembers provides batch processing functions for recomputing structure paths, progress totals, and drip unlocks. Use these functions when you need to recalculate data after bulk changes.
Unified Recompute
The easiest way to recompute all data for structures:
// Recompute everything for specific structures
brm_schedule_unified_recompute( [
'structures' => [ 'courses' ],
'spm' => true, // Structure paths
'progress' => true, // Progress totals
'drip' => true // Drip unlocks
] );
// Recompute for all structures
brm_schedule_unified_recompute( [
'structures' => null, // All structures
'spm' => true,
'progress' => true,
'drip' => true
] );
// Recompute for specific post types
brm_schedule_unified_recompute( [
'post_types' => [ 'lesson' ],
'spm' => true,
'progress' => true,
'drip' => true
] );
When to Recompute
Recompute data when you make bulk changes that affect structure relationships or totals:
- After importing content in bulk
- After reorganizing structure hierarchy
- After bulk content updates
- When progress totals seem incorrect
Adjusting Batch Sizes
Batch sizes are managed internally based on host profiling. For user backfill specifically, you can adjust the number of posts processed via brm_unlocks_user_worker_posts_per_page if needed.
Monitoring Progress
Batch processing runs automatically and updates progress. You can check progress via admin interface or hooks:
Batch processing completion is tracked via transients. Check completion status programmatically:
// Check if batch processing is complete
$spm_completed = (int) get_transient( 'brm_batch_spm_completed' );
$progress_completed = (int) get_transient( 'brm_batch_progress_completed' );
$drip_completed = (int) get_transient( 'brm_batch_drip_completed' );
if ( $spm_completed ) {
error_log( 'SPM batch processing completed' );
}
Best Practices
- Use unified recompute: Simplest way to ensure all data is up to date
- Adjust batch sizes: Match your hosting capabilities
- Monitor progress: Use hooks to track batch completion