Fix enabled-sources checkbox not persisting when all unchecked

Browser omits checkbox fields from POST when none are checked, so the
prautoblogger_enabled_sources option retained its previous value (with
Reddit). Added a hidden input to the checkboxes renderer so an empty
value is always submitted. Also replaced the hardcoded "Collecting
sources from Reddit…" pipeline status with a dynamic message reflecting
actually-enabled sources.

Bump 0.6.2 → 0.6.3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-20 12:18:59 +07:00
parent 4791e54821
commit 86ceea0da1
5 changed files with 26 additions and 4 deletions

View File

@@ -46,7 +46,10 @@ class PRAutoBlogger_Source_Collector {
* @return int Total number of new records inserted.
*/
public function collect_from_all_sources(): int {
$enabled = json_decode( get_option( 'prautoblogger_enabled_sources', '["reddit"]' ), true );
$raw = get_option( 'prautoblogger_enabled_sources', '["reddit"]' );
$enabled = json_decode( (string) $raw, true );
// Only fall back to reddit if the option is corrupt (non-JSON).
// An empty array '[]' is a valid choice — the user disabled all sources.
if ( ! is_array( $enabled ) ) {
$enabled = [ 'reddit' ];
}