=== MemberSutra – Membership & Subscriptions for WooCommerce ===
Contributors: fresheradvice
Tags: membership, woocommerce, restrict content, subscriptions, members
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.2
Stable tag: 1.49.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sell membership plans and subscriptions with WooCommerce and restrict posts, pages and products to members.

== Description ==

MemberSutra lets you sell membership plans and subscriptions through
WooCommerce, use them to restrict pages, posts and products, and gives members
their own Memberships and Subscriptions tabs in My Account.

MemberSutra runs entirely on its own -- nothing else from us is required for it to work.
MemberSutra Pro for WooCommerce is a separate, optional plugin that adds premium
features; Pro itself requires this plugin to be installed and active.

= Free features =
* Unlimited membership plans: free, fixed-length and subscription plans sold through WooCommerce products
* Subscriptions billed through WooCommerce with native Stripe and PayPal recurring payments, renewing every 1-7 days or 1-3 weeks
* Content restriction for posts, pages and products, with restriction rules, access rules and RSS feed protection
* Manual and automatic membership assignment, and approval after purchase
* Membership and subscription lists, detail pages, pause / resume / cancel rules and an activity ledger
* My Account "Memberships" and "Subscriptions" tabs (card layout)
* Membership, subscription and account e-mails with editable templates
* Login protection (failed-login lockouts) and new-user approval
* Tools: data export, database tools, scheduled tasks, audit log and system status

= Pro features (MemberSutra Pro for WooCommerce, a separate plugin) =
* Monthly / yearly billing cycles, signup fees, free trials, one-time purchase and discount pricing on subscriptions
* Renewal synchronization and Subscription box products
* Download credits, protected files and the credits override per product
* Drip content ("available N days after signup") and the partial-content locking shortcode
* Member discounts, gift memberships and subscriptions
* Paywall restriction mode, content blocks and the MemberSutra Gutenberg / Elementor blocks
* Two-factor e-mail login codes
* Member self-service (switch plan, cancel, pause), bulk actions, members CSV import
* Advanced analytics and reports, and additional My Account layouts

The Pro features are not included in this plugin: MemberSutra Pro for WooCommerce is a separate plugin, sold at https://sutraplugins.com. This plugin's screens only mention them; everything listed under "Free features" works without Pro.

= Credits =
* Inter and Sora fonts (bundled in assets/fonts, used only on this plugin's admin screens): SIL Open Font License 1.1, https://openfontlicense.org

== External Services ==

MemberSutra integrates with the following third-party services to deliver subscription billing and administration functionality:

1. Stripe API
* Service URL: https://api.stripe.com
* Purpose: Native recurring payments, automated subscription renewals, customer management, and webhook event processing.
* Data Sent: Customer email, order ID, product/plan amounts, currency, and subscription lifecycle metadata.
* Terms of Service: https://stripe.com/legal/ssa
* Privacy Policy: https://stripe.com/privacy

2. PayPal API
* Service URL: https://api-m.paypal.com and https://api-m.sandbox.paypal.com
* Purpose: Subscription agreement verification and recurring billing webhook event synchronization.
* Data Sent: Order identifiers, customer email, subscription tokens, and transaction amounts.
* Terms of Service: https://www.paypal.com/legalhub/useragreement-full
* Privacy Policy: https://www.paypal.com/legalhub/privacy-full

3. Public IP lookup (ipify / icanhazip) -- off by default
* Service URLs: https://api.ipify.org and https://icanhazip.com (a site can replace the list with the `membersutra_external_ip_services` filter)
* Purpose: only when Settings > "Use external services to get user IP Address" is turned on AND the visitor's address is a loopback address (the site runs on the same machine, e.g. local development), the site asks one of these services for its public IP address so audit and membership records do not all show 127.0.0.1. The answer is cached for 6 hours.
* Data Sent: an ordinary HTTPS GET request from the server; no visitor, member or order data is sent.
* ipify Terms / Privacy: https://www.ipify.org (the service states it does not log visitor data)
* icanhazip Terms / Privacy: https://www.cloudflare.com/website-terms/ and https://www.cloudflare.com/privacypolicy/ (operated by Cloudflare)

4. MemberSutra add-on server -- when an administrator opens MemberSutra > Add-ons
* Service URL: https://addons.sutraplugins.com
* Purpose: the Add-ons page reads the public list of MemberSutra's free payment plugins (Stripe, PayPal, Razorpay) and of the add-ons included with MemberSutra Pro for WooCommerce (names, versions, descriptions), cached for 12 hours. The payment plugins' Download buttons link to their zip files on this server. This plugin never installs or updates anything from it; downloaded plugins are installed by the site owner through Plugins > Add New > Upload Plugin.
* Updates (website download only): a copy downloaded from sutraplugins.com also reads that public list when WordPress checks for plugin updates, and downloads a new version of MemberSutra or of an installed SutraPay payment plugin from the same server. Each download is verified (SHA-256 and the publisher's RSA signature) before it is installed.
* Data Sent: an ordinary HTTPS GET request from the server; no site, user, member or order data is sent.
* Terms of Service and Privacy Policy: https://sutraplugins.com/terms-and-conditions/ and https://sutraplugins.com/privacy-policy/

== Installation ==

1. Upload the plugin files to /wp-content/plugins/membersutra, or
   install the zip through Plugins > Add New > Upload Plugin.
2. Activate the plugin. WooCommerce must be installed and active.
3. Go to MemberSutra in the admin menu to create your first plan.

== Changelog ==

= 1.49.0 =
* Removed: the Freemius SDK and its opt-in screen. The free plugin no longer talks to Freemius at all; MemberSutra Pro for WooCommerce is now its own Freemius product and handles its licence itself.
* Changed: new MemberSutra icons in the admin menu, the top bar and the plugin screens.

= 1.48.0 =
* Changed: every internal name is now MemberSutra: code, settings, database tables, shortcodes ([membersutra_...]), admin pages (admin.php?page=membersutra...), styles and scripts. Earlier builds used flexwoomemberships / flexwoo.
* Changed: author Sutra Plugins, https://sutraplugins.com; the add-on server and the Google Drive sign-in service are addons.sutraplugins.com and oauth.sutraplugins.com.
* Changed: the wp-config.php switches are MEMBERSUTRA_DISABLE_2FA and MEMBERSUTRA_DEMO_DATA.

= 1.47.0 =
* Security: comments on restricted posts are no longer readable through the REST API, the comments feed or comment widgets.
* Security: REST searches no longer list restricted posts that match a search word, and the posts feeds no longer list restricted posts.
* Security: the debug log has a random file name; Tools > Diagnostics > Security Scan reports when the private files folder is readable from the web (nginx). An update must contain the plugin and version that were announced. Used download and claim tokens are cleaned up daily.
* Added (website download): updates arrive through WordPress's own Updates screen from sutraplugins.com's add-on server, for MemberSutra and the SutraPay payment plugins. Every download is verified (SHA-256 and RSA signature) before it is installed.
* Changed: the payment plugins are now called SutraPay for Stripe, SutraPay for PayPal and SutraPay for Razorpay; the website is sutraplugins.com.
* Fixed: uninstall keeps the data while a copy of the Pro plugin in its previous folder is still installed.

= 1.46.1 =
* Security: Freemius SDK updated to 2.13.5 (fixes the issues Freemius reported in earlier versions).
* Changed: the optional Pro plugin is now called MemberSutra Pro for WooCommerce on every screen.
* Fixed: "Delete all plugin data on uninstall" left the gifts and Stripe subscriptions tables behind.
* Fixed: the Membership Plans links on Subscriptions > Settings led to a "not allowed" page.
* Changed: the optional Freemius opt-in reminder shows only on this plugin's screens, the Dashboard and Plugins.
* Changed: saved blocks use block API version 3; exported files are named membersutra-*.

= 1.46.0 =
* Changed: the plugin is now called MemberSutra (WordPress.org permalink and text domain membersutra; the folder is membersutra/). Settings, memberships and subscriptions are kept. A copy in an older folder is switched off and can be removed with one button.

= 1.45.0 =
* Changed: the plugin is now called Flex Memberships (WordPress.org permalink flex-memberships-for-woocommerce; text domain flex-memberships-for-woocommerce). Settings, memberships and all data are kept.
* Added: MemberSutra > Add-ons lists the free MemberSutra payment plugins (Stripe, PayPal, Razorpay) with download links, and the add-ons included with MemberSutra Pro for WooCommerce. The list comes from the MemberSutra add-on server (see External Services); nothing is installed from it. It replaces the Freemius Add-Ons screen.
* Changed: protected files (Membership Options box) show an upload icon instead of the Upload button, so add-on file sources (for example Google Drive) fit next to it.
* Developers: new filter membersutra_stream_download lets an add-on deliver member downloads and protected files it stores elsewhere (for example Google Drive), after the usual access, credit and one-time-link checks.

= 1.44.1 =
* Fixed: the plan editor's Permissions panel now shows "Pages / Posts / Products available: Immediately or After N days from signup" for each plan. The setting was saved and applied by Pro but its control was never displayed. Without Pro, an upgrade notice is shown in its place.
* Changed: "WC tested up to" 11.2.1.

= 1.44.0 =
* Added: Freemius SDK 2.13.4 (vendor/freemius): an optional opt-in screen (with Skip) for update and security e-mails and usage data, and Account and Add-Ons screens under MemberSutra. Nothing is sent to Freemius unless the site administrator opts in; every MemberSutra screen stays usable before the choice is made.
* Added: MemberSutra Pro for WooCommerce is licensed and updated through Freemius as an add-on of this plugin. New filter `membersutra_pro_licensed` lets Pro report whether its licence allows its features.
* Fixed: with "Hide price and add to cart buttons for members" on, the Price column on the Products screen showed "–" for products of a plan the store owner also belonged to. The setting now applies to the shop only; prices always show in the WordPress admin.

Older versions: see CHANGELOG.md in the plugin folder.

== Upgrade Notice ==

= 1.49.0 =
No more Freemius opt-in screen in the free plugin. Update MemberSutra Pro to 1.26.0 at the same time.

= 1.48.0 =
First build under the MemberSutra code names. Data from earlier builds is not carried over: install fresh. Use with MemberSutra Pro 1.25.0 and SutraPay (Stripe 0.13.0, PayPal 0.10.0, Razorpay 1.2.0).

= 1.47.0 =
Adds updates from sutraplugins.com and the new names of the payment plugins (SutraPay). Update together with MemberSutra Pro for WooCommerce 1.24.0.

= 1.46.1 =
Security update of the bundled Freemius SDK (2.13.5).

= 1.46.0 =
Renamed to MemberSutra (new folder; settings and data are kept). Update together with MemberSutra Pro for WooCommerce 1.23.1.

= 1.45.0 =
Renamed to Flex Memberships (new folder; settings and data are kept). Adds the Add-ons page. Update together with MemberSutra Pro for WooCommerce 1.23.0. No database changes.
