The plugin keeps each site’s user records up to date with a user sync: every user gets a last activity date, and every user with a role on the site gets a BuddyPress blog record and a profile name. Since 1.1.3 the sync is scheduled through LH_Buddypress_Multi_Network_Queue (includes/class-lh-buddypress-multi-network-queue.php). It runs on Action Scheduler when the current site has it, in the lh-buddypress-multi-network group (listed under Tools → Scheduled Actions), and on WP-Cron otherwise. The same hooks are used on both runners, and on Action Scheduler any WP-Cron copy of a job is cleared so it runs once.
lh_bmn_wakeup – starts the daily sync, per site. Created on init (throttled hourly by the lh_bmn_schedule_checked transient) on each site where BuddyPress loads, with up to 1000 seconds of jitter, so sites added later get it too.lh_bmn_single – starts a one-off sync 30 seconds after a user registers, is added to the site or updates a profile. While one is waiting no other is queued, so a burst of changes starts the sync once.lh_bmn_batch – one batch of a running sync (since 1.1.4). Each batch handles up to 50 users or 20 seconds, then queues the next, until the run is done.Before 1.1.4 the whole sync ran in one request, which on a large site could outlive the host’s time limit and be killed. Now start_sync() records a run in the lh_bmn_sync_state option (run id, phase, cursor) and queues the first batch, and run_batch() works through two phases, walking user IDs upwards from the stored cursor: first the activity phase, which gives every user a last activity row, then the members phase, which records the site’s users in its blogs table and fills in missing names. Progress is saved after each chunk, and every step is safe to repeat, so a batch killed part-way redoes at most one chunk. The option is deleted when the run finishes.
Starting a sync while one is running starts a new run from the beginning; the batch already running notices at its next save and stops. This is cheap, because users already handled drop out of both phases. The hourly schedule check also queues a batch for any run that has made no progress for 15 minutes, so a run whose request was killed carries on.
A user added to a site is handled while WordPress is switched to that site, so that sync goes to the site’s WP-Cron: Action Scheduler is only safe for the site the request is running on. On deactivation the whole Action Scheduler group is cancelled on the current site, every WP-Cron instance of the plugin’s hooks is removed (including the retired lh_bmn_process) and any run in progress is cleared; on network deactivation WP-Cron is also cleared on every other site.
lh_bmn_wakeup_hook, lh_bmn_single_hook, lh_bmn_batch_hook – the job hook names.lh_bmn_batch_size – users per batch (default 50).lh_bmn_batch_time_limit – seconds a batch may run (default 20, minimum 5).lh_bmn_stall_after – seconds without progress before a run is resumed (default 900, minimum 300).lh_bmn_uses_action_scheduler – return false to keep every job on WP-Cron.