Skip to content

Editor controls and shortcode not appearing; locked content not enforced Summary: In WordPress, the Paywall Anywhere editor controls are not visible and the shortcode is not recognized. I need the editor UI controls added and functional, and I need an...#5

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-3189bf62-facc-4af0-88f4-099867fb1565

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 29, 2025

Progress Update - Editor Controls Fixed

Completed:

  • Inspector panel title wrong: Currently "Paywall Settings", needs to be "Paywall Anywhere — Locking" ✅
  • Toggle label wrong: Currently "Lock this block", needs to be "Lock this block (Paywall Anywhere)" ✅
  • Script enqueuing uses wrong path - should use built files from /build/ directory ✅
  • Add "Paywall Anywhere — Locked Elements" right-side panel ✅
  • Missing expires_days input field in Inspector panel ✅ (Already present as "Access Duration (Days)")

In Progress:

  • Missing "Find & Lock (Paywall Anywhere)" command in command palette (Ctrl+K) - Added registration but needs testing
  • Add lock badge overlay for locked blocks - Exists but may need improvements

Shortcode Issues:

  • Test shortcode implementation exists but verify enforcement works
  • Need to verify server-side content filtering works properly
  • Ensure locked content never leaks to frontend/REST/feeds

Technical Changes Made:

  • ✅ Fixed editor script enqueuing to use built files from /build/ directory
  • ✅ Updated Inspector panel title to "Paywall Anywhere — Locking"
  • ✅ Updated toggle label to "Lock this block (Paywall Anywhere)"
  • ✅ Added "Paywall Anywhere — Locked Elements" sidebar panel with:
    • Shows all locked blocks in current post
    • Displays scope, price, and expiry for each
    • Quick Unlock and Jump to functionality
  • ✅ Added Command Palette integration for "Find & Lock (Paywall Anywhere)"
  • ✅ Build successful, JavaScript compiled without errors

Next Steps:

  • Test Command Palette integration functionality
  • Verify shortcode server-side enforcement
  • Test Inspector panel functionality
  • Verify lock badge overlay displays correctly
Original prompt

Editor controls and shortcode not appearing; locked content not enforced

Summary:
In WordPress, the Paywall Anywhere editor controls are not visible and the shortcode is not recognized. I need the editor UI controls added and functional, and I need any content placed between the shortcode tags to be locked until payment.

Environment:

WordPress {version}

Paywall Anywhere {version}

Gutenberg/Block Editor enabled

What’s wrong (Actual behavior)

No Paywall Anywhere controls appear in the block editor (Inspector/sidebar, toolbar, or command palette).

The shortcode renders raw or is ignored; content between tags is not locked.

What I expect (Required fixes)

  1. Add clear, working editor controls (Block Editor)

Inspector Panel (specific name):
Panel title: “Paywall Anywhere — Locking”
Inside every block’s sidebar, add:

Toggle: Lock this block (Paywall Anywhere)

Inputs (optional): Price (cents), Expires (days) — fall back to global defaults if blank.

Badge: When locked, show a small lock badge overlay in the canvas.

Command Palette / Quick Search:
Add a command “Find & Lock (Paywall Anywhere)” that lets me search the current post’s blocks by type and text. From results, I can Lock / Unlock / Jump to.

Locked Elements panel:
Add a right-side panel named “Paywall Anywhere — Locked Elements” listing all locked items in the current post (scope, price, expiry) with quick Unlock and Edit.

  1. Implement and document the shortcode (must lock section)

Shortcode name: [paywall_anywhere_lock] ... [/paywall_anywhere_lock]

Attributes (optional):

price="500" (in cents; default to Settings if omitted)

expires_days="30" (0 = never; default to Settings if omitted)

Behavior:

Everything between the opening and closing tags is server-side hidden until paid.

For unauthorized users, render a placeholder + unlock CTA; do not output the original HTML to the DOM, REST API, feeds, or meta tags.

Examples:

[paywall_anywhere_lock]
This section (text, HTML, blocks rendered in content) is premium.
[/paywall_anywhere_lock]

[paywall_anywhere_lock price="799" expires_days="14"]
Premium recipe card + printable PDF download.
[/paywall_anywhere_lock]

  1. Ensure server-side enforcement

Intercept on the_content and render_block.

Replace locked content with placeholders for unauthorized users.

Block access in REST, feeds, oEmbed, and OG/Twitter card fields.

Steps to reproduce (after fix)

Open any post in the block editor.

Select any block → In the sidebar, see “Paywall Anywhere — Locking” panel → toggle “Lock this block (Paywall Anywhere)”.

Press Cmd/Ctrl+K → run “Find & Lock (Paywall Anywhere)”, search a block by text, and lock it.

Add the shortcode examples above to the post.

View the post while logged out: locked blocks and shortcode sections display placeholders; originals are not in page source.

Complete payment → content unlocks immediately.

Acceptance criteria

Inspector panel named “Paywall Anywhere — Locking” appears for all blocks with a working Lock this block (Paywall Anywhere) toggle.

Find & Lock (Paywall Anywhere) command can search by block type and inner text; actions work.

Locked Elements panel lists, navigates, and unlocks items.

[paywall_anywhere_lock]…[/paywall_anywhere_lock] locks the enclosed section server-side; attributes override defaults; unauthorized users never receive the original HTML.

No console/PHP errors; UI strings translatable; nonce + capability checks on all writes.

Notes

Keep naming exactly as specified above.

Use existing global defaults for price/expiry when per-item values are blank.

Placeholders must be theme-friendly and accessible (announce “Premium content locked”).


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…ts panel, fix script enqueuing

Co-authored-by: HusnainRKI <226229722+HusnainRKI@users.noreply.github.com>
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