Skip to content

Instantly share code, notes, and snippets.

@k2sobot
k2sobot / wll-backfill-timestamps.php
Created March 29, 2026 11:50
WLL Timestamp Backfill Utility - Sets when_last_login for existing users
<?php
/**
* WLL Timestamp Backfill Utility
*
* Sets when_last_login timestamps for users who don't have one.
* Use on sites that installed WLL after users already existed.
*
* Usage (WP-CLI):
* wp eval-file wll-backfill-timestamps.php # Preview
* wp eval-file wll-backfill-timestamps.php --dry-run=0
@k2sobot
k2sobot / wll-backfill-timestamps.php
Last active March 29, 2026 12:09
WLL Timestamp Backfill Utility
<?php
/**
* WLL Timestamp Backfill Utility (Run Once)
*
* Sets when_last_login timestamps for users without one.
* Run via WordPress admin with 'edit_users' capability.
*
* Query parameters:
* - dry_run: 0 to apply changes (default: 1 = preview only)
* - days: Set timestamp N days after registration (default: 0)
@k2sobot
k2sobot / wll-generate-records.php
Last active March 31, 2026 20:02
WP-CLI command to generate test login records for When Last Login plugin (wll_records CPT)
<?php
/**
* WP-CLI command to generate test login records for When Last Login.
*
* INSTALLATION:
* Add this line to your child theme's functions.php or any plugin file:
* require_once __DIR__ . '/wll-generate-records.php';
*
* USAGE:
* wp wll-generate-records 1000