=== WP Secure Content ===
Contributors: fahadmahmood, invoicepress
Tags: restrict content, members only, password protect, content protection, woocommerce, membership, paywall
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.2
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Control who can see your posts, pages and WooCommerce products: members only, specific roles or a password, with optional copy protection.

== Description ==

WP Secure Content lets you lock down any post, page, or WooCommerce product without writing a single line of code. Choose per item whether content is public, members only, restricted to specific roles, or protected by a password — and optionally add copy protection on top.

**Why use it?**

* Turn selected content into a members-only area without a heavy membership plugin.
* Gate premium products or downloads behind a password or role.
* Show a teaser to logged-out visitors to encourage sign-ups.
* Lock just part of a page with a shortcode when the whole page should stay public.

**Core features**

* **Per-item "Content access" box** — set access on each post, page, or product: public, members only, specific roles, or password protected.
* **Sensible defaults per content type** — choose a default access level for posts, pages, and products; override it per item whenever needed.
* **Bulk actions** — apply access changes to many posts at once from the post list screens.
* **Teaser previews** — display a short excerpt above the lock message to give visitors a taste of what's behind the gate.
* **Custom lock messages** — separate, editable messages for logged-out visitors, disallowed roles, and the password prompt.
* **Brute-force protection** — passwords are rate-limited to slow down guessing attempts.
* **Deep protection** — also protects excerpts, the REST API, and feeds so the content can't leak through alternate channels.
* **WooCommerce aware** — locked products cannot be purchased, and access is enforced on the product page.
* **Shortcode** — wrap any part of a page in `[wpsc_protect]...[/wpsc_protect]` to lock only that block.
* **Optional copy protection** — block right-click, text selection, copy keys, dragging, and printing. Configurable and off by default.
* **Administrator bypass** — admins and post editors can always view protected content, and skip copy protection.

**Where to configure it**

Go to **Settings → WP Secure Content** and use the tabs:

1. **Content protection** — enable content types, set default access, teaser and lock messages, and exceptions.
2. **Copy protection** — toggle and tune the copy-protection behaviours.
3. **Protected content** — review every item that is currently locked.
4. **Category rules** — apply access rules to whole categories.

== Installation ==

1. Upload the `wp-secure-content` folder to `/wp-content/plugins/`, or install the plugin through **Plugins → Add New** in WordPress.
2. Activate the plugin through the **Plugins** screen.
3. Open **Settings → WP Secure Content** to choose your defaults and messages.
4. Edit any post, page, or product and use the **Content access** box to override access for that item.

== Usage ==

**Lock a single item**

Edit the post, page, or product and open the **Content access** box in the sidebar. Select Public, Members only, Specific roles, or Password, then save.

**Lock part of a page with a shortcode**

[code]
[wpsc_protect]Members only text[/wpsc_protect]
[/code]

Restrict to specific roles and show a custom message:

[code]
[wpsc_protect roles="subscriber,customer" message="Customers only."]...[/wpsc_protect]
[/code]

Attributes:

* `roles` — comma-separated role slugs allowed to view the block.
* `message` — custom message shown when the visitor cannot view the block.
* `password` — require a password for the block.

**Set defaults for a content type**

On the **Content protection** tab, enable the content types you want to lock and choose a default access level for each. Individual items can still override the default.

**Bulk edit access**

From the post list screen, select multiple items, choose the access action in the **Bulk actions** dropdown, and apply.

== Frequently Asked Questions ==

= Does this work with WooCommerce? =

Yes. Products can be locked like any other content type, and locked products cannot be purchased.

= Can I protect only part of a page? =

Yes. Use the `[wpsc_protect]` shortcode to wrap the section you want to lock.

= Are excerpts, the REST API and feeds protected too? =

Yes. When an item is locked, its excerpt, REST API representation, and feed entry are protected as well.

= Can administrators always see locked content? =

By default, yes. Administrators and post editors can bypass protection. You can turn this off on the **Content protection** tab.

= Is copy protection enabled by default? =

No. Copy protection is optional and configurable on the **Copy protection** tab.

= Does it support password-protected items? =

Yes, and password attempts are rate-limited to reduce brute-force guessing.

= What happens to my old exclusions when I upgrade to 2.0? =

Old exclusions are migrated automatically. Check **Protected content** after upgrading to review the result.

= Can I use this alongside a membership plugin? =

Yes. Access is role-based, so it composes with any plugin that manages WordPress roles.

== Screenshots ==

1. Content protection settings — content types, defaults, teaser and lock messages.
2. Copy protection settings.
3. The Protected content list.
4. Category rules

== Pro ==

Pro adds unlock-by-purchase (WooCommerce), access windows, multiple passwords, and category rules.

**Enabling Pro**

1. Drop the `pro/` folder into the plugin folder.
2. Visit **Settings → WP Secure Content** — Pro features appear automatically.
3. Remove the `pro/` folder at any time to return to the free version. Your data is preserved.

== Changelog ==

= 2.0.0 =
* Rebuilt from the ground up.
* Per-post access rules with a "Content access" box on the edit screen.
* Clear settings organised into tabs.
* New Protected content list.
* `[wpsc_protect]` shortcode for locking part of a page.
* REST API and excerpt protection.
* Copy protection is now optional and configurable.
* Old exclusions are migrated automatically.

== Upgrade Notice ==

= 2.0.0 =
This is a full rebuild. Your old exclusions are migrated automatically, but please review Settings → WP Secure Content after upgrading to confirm your access rules and copy-protection settings.

== License ==

WP Secure Content is free software, released under the GPLv2 or later.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.