=== Subscription System ===
Contributors: mediahubster
Donate link: https://mediahubster.in/
Tags: subscription, user registration, login, membership, user management
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.0.18
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A powerful subscription management system for WordPress that allows users to register and login through customizable forms.

== Description ==

Subscription System is a comprehensive WordPress plugin that provides a complete user registration and login solution for your website. With easy-to-use shortcodes and a user-friendly admin interface, you can quickly set up subscription forms and manage user registrations.

**Key Features:**

* **User Registration Forms** - Create beautiful registration forms with username, email, and password fields
* **User Login Forms** - Provide secure login functionality for your users
* **Admin Dashboard** - Comprehensive admin interface to manage settings and view statistics
* **Shortcode Support** - Easy integration with `[subscription_register]` and `[subscription_login]` shortcodes
* **Security Features** - Built-in nonce verification and input sanitization
* **Responsive Design** - Mobile-friendly forms that work on all devices
* **Translation Ready** - Full internationalization support
* **WordPress Standards** - Follows WordPress coding standards and best practices

**Available Shortcodes:**

* `[subs_sys_register]` - Displays a user registration form (recommended)

* `[subs_sys_login]` - Displays a user login form (recommended)
* `[subscription_register]` - Legacy shortcode (still supported)
* `[subscription_login]` - Legacy shortcode (still supported)

**Admin Features:**

* Enable/disable user registration
* View user statistics
* Quick access to WordPress user management
* Comprehensive help documentation
* System status monitoring

== Installation ==

1. Upload the `subscription-system` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to 'Subscription System' in your admin menu to configure settings
4. Use the shortcodes `[subs_sys_register]` and `[subs_sys_login]` in your pages or posts

== Frequently Asked Questions ==

= How do I display a registration form? =

Simply add the shortcode `[subs_sys_register]` to any page or post where you want the registration form to appear. The legacy shortcode `[subscription_register]` is also supported.

= How do I display a login form? =

Use the shortcode `[subs_sys_login]` in any page or post to display the login form. The legacy shortcode `[subscription_login]` is also supported.

= Can I disable user registration? =

Yes, go to the Subscription System settings page in your WordPress admin and toggle the "Enable User Registration" option.

= Is the plugin translation ready? =

Yes, the plugin is fully translation ready and includes proper internationalization support.

= What happens after a user registers? =

After successful registration, users can optionally be automatically logged in (depending on your settings) and will receive appropriate success messages.

= Are the forms secure? =

Yes, all forms include proper nonce verification, input sanitization, and follow WordPress security best practices.

== Screenshots ==

1. Admin dashboard showing plugin statistics and quick actions
2. Plugin settings page with registration toggle
3. Help page with shortcode documentation
4. Registration form on the frontend
5. Login form on the frontend

== Changelog ==

= 1.0.18 =
**Subscribe Button & Modal — Category / Tag Interest Subscriptions**
* Added new "Subscribe Button & Modal" admin settings tab with full trigger, display, and context configuration
* Floating subscribe button with configurable position (bottom-right, bottom-left, bottom-center)
* Auto-open modal on page load with configurable delay
* Shortcode `[subscriptionsystem_subscribe]` to place a subscribe button anywhere
* Context-aware modal: automatically detects and pre-selects the current post's categories and tags
* Logged-in user experience: hides name/email fields, greets user by name, and auto-fills their details
* Guest (not-logged-in) modal now shows a "Log in / Not now" panel instead of the full form
* After login, modal automatically reopens on the same page via `?ss_subscribe=1` URL parameter
* Session parameter is silently removed from the URL via `history.replaceState` after modal opens

**Content Plans (Subscribe to Updates)**
* Modal now sources plans exclusively from **Subscription → Content Plans** instead of generic plans
* Strict plan filtering: only shows plans whose categories/tags exactly match the current post
* Each plan card now displays which categories or tags it covers (e.g. "Category: Technology")
* Conflict prevention: categories and tags already assigned to one active plan are shown as disabled (greyed out with "Used by: [Plan Name]" badge) when creating/editing another plan
* Backend validation blocks saving a plan with duplicate categories/tags — clear error message lists every conflict
* Content Plans admin list now has a **Stripe** column showing connection status (Connected / Mock / None)
* "Sync with Stripe" link on each Content Plan — creates/updates Stripe Product and Price, saves IDs back to DB
* Free content plans skip Stripe price creation (product only)

**Checkout & Payment**
* Interest subscription checkout now creates a real **Stripe Checkout Session** and redirects users to Stripe's hosted payment page
* Plan lookup fixed to read from `subscription_content_plans` (or falls back to `subscription_plans` for legacy records)
* Uses pre-synced `stripe_price_id` when available; falls back to inline `price_data` for unsynced plans
* New `/?action=interest_checkout_success` handler: verifies Stripe session, activates the subscription, and shows a styled success page
* Cancelled Stripe sessions return to the checkout info page with a clear "Payment was cancelled" notice
* Fallback info page (when Stripe is not configured) now shows an admin-only "Configure Stripe →" button

**Subscriber Experience Improvements**
* Modal categories/tags list filtered to show only terms assigned to the current post (not all site terms)
* Section labels update contextually: "Categories in this post" / "Tags in this post" vs. "Select Categories"
* All post-specific categories and tags are pre-checked by default
* Intro text adapts: "Subscribe to get notified when new content is published in these topics."
* Empty categories or tags sections are hidden rather than showing a placeholder

**Plan Management (Subscription Plans)**
* Add/Edit plan forms include Status (Active/Inactive), Max Categories, and Max Tags fields
* Plans list table shows Interest Limits ("Cat: X, Tags: Y") and Status badge
* Backend correctly saves `features` JSON with `max_categories`, `max_tags`, and `status` on both create and update

= 1.0.17 =
* Improved compatibility with the latest WordPress releases, including WordPress 7.0
* Enhanced codebase structure with clearer organization and improved maintainability
* Refined plugin bootstrap, hooks, and REST API integration for modern WordPress standards
* Updated compatibility checks and future-proofing for WordPress 7.0 features
* General stability, performance, and security improvements across the plugin

= 1.0.16 =
* Released a maintenance update for compatibility, stability, and future improvements.

= 1.0.15 =
* Released a maintenance update for compatibility, stability, and future improvements.
* Updated for full compatibility with WordPress 6.9.4 and WordPress 7.0
* Updated minimum PHP requirement to 8.0 (PHP 7.4 reached end-of-life)
* Improved code compatibility with latest WordPress standards
* Modernized JavaScript implementation for better performance
* Enhanced security and performance optimizations
* Tested and verified compatibility with WordPress 7.0 (scheduled April 9, 2026)

= 1.0.14 =
* Version bump for production deployment
* Maintenance release

= 1.0.13 =
* Fixed work logs page permission issue - users can now access their own work logs
* Added permission checks to prevent users from viewing other users' work logs
* Updated work logs page capability from 'manage_options' to 'read'
* Fixed work logs URL format for better compatibility
* Non-admin users can now view their work logs while admins retain full access

= 1.0.12 =
* Added intelligent debug panel to Subscribers page for troubleshooting
* Improved subscriber query with better error logging
* Added database statistics display to identify subscription issues
* Enhanced subscribers page to show warnings when no subscriptions exist
* Added helpful guidance for setting up first subscriptions

= 1.0.11 =
* Added "One Day (Testing)" duration option for quick subscription testing
* Added "Weekly" (7 days) duration option for subscription plans
* Enhanced plan preview to display correct duration labels for new options
* Improved testing capabilities for subscription workflows

= 1.0.6 =
* CRITICAL FIX: Fixed login and registration form submission issues
* Fixed JavaScript/PHP naming mismatch causing forms to get stuck on "PROCESSING..."
* CRITICAL FIX: Fixed duplicate email notifications (users were receiving 2-3 emails per post)
* CRITICAL FIX: Fixed subscription plans page not saving - plans now save and redirect properly
* CRITICAL FIX: Fixed duplicate admin menu items - menus were showing twice in sidebar
* Added two-layer duplicate prevention system (request-level + database-level)
* Updated all AJAX actions to use correct naming convention (subs_sys_*)
* Added comprehensive Email Logs system to track all sent emails
* Added Email Logs admin page with filtering, search, and statistics
* Implemented email tracking for content notifications
* Added automatic database table creation (runs on every plugin load)
* Added database table for email logging with safe migration support
* Reorganized admin menu structure - logical hierarchy with related items grouped together
* Content Plans moved from bottom to 4th position in menu for better accessibility
* Plans page now shows success messages after creating/editing and redirects to list view
* Content Plans page now redirects properly after creating/editing/deleting
* Fixed Content Plans admin page showing developer notes and console.log statements
* Removed duplicate menu registrations that caused menus to appear twice
* Bumped version to force browser cache refresh of updated JavaScript
* All forms (login, registration, forgot password, reset password) now work correctly
* Email notifications now send exactly ONE email per user per post
* Admin navigation is now clean, organized, and professional

= 1.0.5 =
* Removed temporary debugging files for production release
* Cleaned up codebase for WordPress.org submission
* Enhanced plugin security by removing development tools
* Optimized plugin package size
* Improved plugin stability and performance

= 1.0.4 =
* Added comprehensive content subscription system with category, tag, and post type subscriptions
* Implemented smart pop-up notifications with "Remind me later" functionality
* Added Medium.com style email notifications for new content
* Integrated SMTP configuration for reliable email delivery (SendGrid, Gmail, Mailgun)
* Created Content Subscribers admin page for managing all content subscriptions
* Added automatic subscription renewal system via Stripe webhooks
* Implemented payment failure handling with retry logic
* Added subscription status management (Active, Cancelled, Past Due)
* Created comprehensive Help & Support documentation with tabbed interface
* Added new shortcodes: [subscriptionsystem_account], [content_subscription_success]
* Enhanced email templates with responsive design and dark mode support
* Improved subscription success pages and redirect handling
* Added PHPMailer compatibility for WordPress 5.5+ with namespaces
* Implemented database schema updates for content subscription tables
* Added debugging tools and enhanced error logging
* Fixed subscription display issues in user account dashboard
* Enhanced pop-up display logic for tag, category, and post archive pages
* Added subscription statistics and revenue tracking
* Improved admin interface with better navigation and styling

= 1.0.3 =
* Fixed Plan Settings menu visibility in admin interface
* Improved menu structure and organization
* Enhanced admin navigation experience

= 1.0.2 =
* Updated admin menu interface
* Improved admin navigation structure
* Enhanced menu organization for better usability

= 1.0.1 =
* Initial stable release
* Added subscription plans management
* Added plan categories
* Added Stripe integration for payments
* Added developer mode for debugging
* Added comprehensive logging system
* Added work items and channels tracking
* Improved database schema
* Enhanced security measures

= 1.0.0 =
* Initial release
* User registration and login shortcodes
* Admin dashboard with statistics
* Settings page for configuration
* Help documentation
* Security features with nonce verification
* Translation ready
* Responsive design
* WordPress coding standards compliance

== Upgrade Notice ==

= 1.0.18 =
Major feature update. Introduces the Subscribe Button & Modal system with floating buttons, auto-open, and context-aware category/tag subscriptions. Content Plans now power the modal with strict per-post plan filtering, Stripe sync, and a full Stripe Checkout payment flow. Guest users see a "Log in / Not now" prompt. Includes plan conflict prevention, improved plan cards, and a polished post-payment success page.

= 1.0.17 =
Recommended update for all users. Improves compatibility with the latest WordPress versions (including WordPress 7.0), enhances codebase structure, and includes general stability and performance improvements.

= 1.0.16 =
Maintenance update for compatibility, stability, and future improvements. Recommended for all users.

= 1.0.6 =
CRITICAL UPDATE! Fixed multiple critical issues: (1) Login/registration forms stuck on "PROCESSING...", (2) Duplicate email notifications sending 2-3 emails per post, (3) Subscription plans page not saving, (4) Admin menus showing twice. Includes automatic database updates, comprehensive email logging, and reorganized admin menu structure. HIGHLY RECOMMENDED for all users.

= 1.0.5 =
Production-ready release with cleaned codebase, removed debugging files, and enhanced security. Recommended update for all users preparing for WordPress.org submission.

= 1.0.4 =
Major update with comprehensive content subscription system, email notifications, SMTP integration, and enhanced admin features. Includes automatic renewal management and improved user experience.

= 1.0.3 =
This update fixes the Plan Settings menu visibility and improves the admin interface navigation. Recommended for all users.

= 1.0.2 =
This update includes improvements to the admin menu interface for better navigation and usability. Recommended for all users.

= 1.0.1 =
Stable release with subscription plans, Stripe integration, and enhanced features. Recommended update for all users.

= 1.0.0 =
Initial release of Subscription System. Install to get powerful user registration and login functionality for your WordPress site.

== Developer Information ==

**Plugin Structure:**
* Follows WordPress Plugin Boilerplate standards
* Object-oriented programming approach
* Proper separation of admin and public functionality
* Internationalization support
* Security best practices

**Hooks and Filters:**
The plugin provides various hooks and filters for developers to extend functionality. Documentation for these will be expanded in future versions.

**Support:**
For support and feature requests, please visit our website at https://mediahubster.in/