Skip to content

Conversation

@soderlind
Copy link
Owner

This pull request introduces a new "protection mode" feature for password-protecting WordPress posts and pages, giving admins more granular control over which content is protected. The settings UI and logic have been updated to support two modes: protecting all posts (with the option to exclude some) or protecting only selected posts. The admin interface is improved for clarity and usability, and Norwegian Bokmål translations have been updated accordingly.

Protection mode feature and settings UI:

  • Added a "protection mode" option allowing admins to choose between protecting all posts (with exclusions) or only selected posts. This includes new settings fields and logic for handling both excluded and protected posts, as well as UI controls for toggling between modes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

  • Updated the JavaScript to initialize Select2 on all relevant fields and to toggle field visibility instantly based on the selected protection mode, improving the admin experience. [1] [2] [3]

Settings and wording improvements:

  • Improved the settings page wording for clarity, including descriptions and field labels, to better reflect the new protection modes and authentication logic. [1] [2] [3]

Translation updates:

  • Updated Norwegian Bokmål translations to match the new UI and features, including new strings for protection mode and improved field descriptions. [1] [2]

Changelog and versioning:

  • Added a new 1.0.2 release section in CHANGELOG.md documenting the new features and improvements, and updated comparison links. [1] [2]

- **admin.js**:
  - Updated the Select2 initialization to apply to all fields with the `passwp-posts-select2` class instead of just the excluded posts field.
  - Added a new function `initProtectionModeToggle` to handle the visibility of excluded and protected posts based on the selected protection mode.

- **class-admin-settings.php**:
  - Added new settings for `protection_mode` and `protected_posts` to the default settings array.
  - Introduced a new settings field for selecting the protection mode (all or selected) and updated the rendering functions for excluded and protected posts.
  - Updated the localization script to include the current protection mode.

- **class-protection.php**:
  - Modified the protection logic to check the selected protection mode. If 'selected' mode is active, only the posts in the protected list will require a password, while all others will be accessible.

- **translations**:
  - Updated Norwegian Bokmål translations to include new strings for protection mode and improved existing translations for clarity.

- **passwp-posts.php**:
  - Bumped the version number to 1.0.2 to reflect the new features.

- **readme.txt**:
  - Updated the tested version to 6.9 and changed the stable tag to 1.0.2. Added a changelog entry for the new protection mode feature.

- **tests**:
  - Updated tests to cover the new `protected_posts` sanitization and validation.
  - Adjusted JavaScript tests to account for the new protection mode functionality.

This commit enhances the plugin's functionality by allowing users to choose between protecting all content or only selected posts, improving usability and flexibility.
@soderlind soderlind merged commit 9042402 into main Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants