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:
@@ -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' ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user