=== SmartWay Suite ===
Contributors: smartwaydesigns
Tags: access control, restrict content, user roles, role manager, media folders
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Restrict content by role, manage roles, sort media into folders and replace files without breaking links. Switch on only what you need.

== Description ==

SmartWay Suite is a set of tools for WordPress sites, in one plugin. Each tool is an **extension** you switch on or off on the SmartWay screen. An extension that's switched off loads nothing, and switching it off keeps its settings.

= Access Control =

Choose who can see what, by role.

* **Pages, posts and other content:** only for logged-in people, only for chosen roles, for logged-in people except chosen roles, only for logged-out visitors, or hidden from chosen roles. Child pages can follow their parent.
* **Categories, tags and whole post types:** one rule covers everything in a category, or every product, and their archive pages too.
* **Menu items, Elementor elements and parts of a page** (with the `[smartway_restrict]` shortcode).
* **Every role counts:** someone who is both a Customer and a Member is never locked out because of the other role.
* **Enforced on the server:** direct links, search, feeds, the REST API and the sitemap all follow the rules.
* **What people see instead:** a message, the login page, the home page or a page you choose. After logging in, people come back to the page they wanted.
* **Whole site:** a private-site switch, a lock that keeps logged-out visitors out of the REST API, and your own login page address (hides wp-login.php), with a rescue link if you're ever locked out.
* **Tools → Access** checks exactly what any person, or a logged-out visitor, can see, and why.
* **Moving from another plugin?** The importer brings over rules from Restrict, Restrict for Elementor, Members, Nav Menu Roles, Content Control and User Menus, shows each one before it changes anything, and can be undone.

= Role Manager =

* Create, edit and clone roles, with a clear capabilities editor.
* **Safe deletes:** deleting a role moves its people to another role first, shows everywhere the role is used, and can be undone.
* **More than one role per person:** tick boxes on Edit user, Add New User and your own profile, so nobody loses a role when their profile is saved.
* Add or remove a role for many people at once on Users → All Users.
* The Administrator role can never be deleted, and you can't remove your own administrator role.

= Media Replace =

* Upload a new version of an image or file **without changing its link**. Every page, product and Elementor design shows the new version straight away.
* The title, alt text, caption and upload date stay. Image sizes are made again.
* Same type only (a JPG for a JPG, a PDF for a PDF), checked by the file's real content.
* In the file's details, on Edit Media, and as a **Replace file** link in the Media Library's list view.

= Page Order =

* **Drag and drop** pages in the Pages list to put them in order. Drag right to put a page under the one above, or left to move it out a level. Child pages move with their parent.
* A **Move** link on each row does the same with the keyboard, and **Undo** puts the last move back.
* Uses WordPress's own Order and Parent fields, so the order stays if you switch it off. Coming from Simple Page Ordering? The order you set carries over.
* If Access Control is on and a move changes who can see the page, you're asked first.

= Media Folders =

* Sort the Media Library into **folders and subfolders**, as many as you like. Files never move on disk, so their links never change.
* **Drag and drop** one file, or a selection, onto a folder. Drag folders to put them in order, or inside one another.
* Right-click a folder (or press Shift+F10) to rename it, add a subfolder or delete it. Double-click or F2 renames too.
* **All files** and **Unorganized** at the top, with a count on every folder. An **Include subfolders** switch shows the files in a folder's subfolders too.
* Files uploaded while a folder is open go straight into it.
* The same folders in every media window: the block editor, the classic editor, WooCommerce product images and galleries, and Elementor.
* In the grid view, a click shows the file's details beside the files instead of a full-screen window, and you can pick several files to move or delete at once.
* A **list view** on the same screen, with each file's folder, date and size.
* A **Folder** field in each file's details, and **Move to folder** for everything you've picked.
* Deleting a folder never deletes files: they move up into its parent folder.
* **Moving from Real Media Library, FileBird, Folders by Premio, Enhanced Media Library, Media Library Organizer or Media Library Folders?** SmartWay → Tools → "Media: import from …" with that plugin's name copies its folders, subfolders and filed files in one click, and changes nothing in the other plugin. It works even after that plugin is deactivated, or its licence has run out.

= Built to stay light =

* Extensions you don't switch on load nothing.
* Visitors' pages load no SmartWay CSS or JavaScript.
* No ads, no upsell notices and no tracking.
* Uninstalling keeps your settings unless you choose to remove them.

= Shortcode =

Access Control's `[smartway_restrict]` shortcode hides part of a page, post or Elementor Shortcode widget. Only the people it names see what's inside.

* `[smartway_restrict roles="customer"]…[/smartway_restrict]`: only people with that role. List several with commas (`roles="customer,member"`): any one of them is enough. Use the role's slug, shown on SmartWay → Roles.
* `[smartway_restrict logged_in="yes"]…[/smartway_restrict]`: anyone who is logged in.
* `[smartway_restrict logged_out="yes"]…[/smartway_restrict]`: only visitors who aren't logged in.
* `message="Members only."`: what everyone else sees. Leave it out to use the site's default message; `message=""` shows nothing.

A misspelled role, or a shortcode with no roles, `logged_in` or `logged_out`, hides the content from everyone, and administrators see a note explaining why. The same guide is in the Access Control settings.

What's inside the shortcode is cleaned the way WordPress cleans post content: scripts are removed, while embedded videos and form fields still work.

= Privacy =

SmartWay Suite doesn't send any data to SmartWay Designs or anyone else, and it doesn't track you or your visitors. The rescue link emails only your site's administrators, through your site's own email.

== Installation ==

1. Go to **Plugins → Add New Plugin**, search for **SmartWay Suite**, and press **Install Now**, then **Activate**.
2. Open **SmartWay** in the admin menu.
3. On the **Extensions** tab, switch on the extensions you want. Each one's settings open from the gear on its card.

== Frequently Asked Questions ==

= Do I need Elementor or WooCommerce? =

No. SmartWay Suite works on its own. When Elementor or WooCommerce is active, Access Control adds its options there too (Elementor elements and page settings, WooCommerce products, product categories and the shop page).

= Can a person have more than one role? =

Yes. With Role Manager on, Edit user shows a tick box for every role. Access Control checks all of a person's roles, so having an extra role never locks anyone out.

= Do administrators see restricted content? =

Yes, by default, like other access plugins. Items only for logged-out visitors, and items hidden from a role, still follow their rule. You can switch this off in the Access Control settings to see your site exactly as your rules make it.

= I'm moving from Restrict, Members or Content Control. Will I lose my rules? =

No. Go to SmartWay → Tools → **Import rules from other plugins**. It lists every rule it found and what it becomes in SmartWay, and changes nothing until you press Import. The other plugin's settings are never changed, and the import can be undone.

= Will Media Replace break my links? =

No. The new file keeps the old one's address, so every page, product and design that uses it shows the new version. Because the address is the same, a browser or page cache might show the old file for a moment; SmartWay clears the common page caches for you.

= Will moving files into folders break my links? =

No. Folders only group files in the Media Library. Each file stays where it is in the uploads folder, so its address, its image sizes and every page that uses it stay the same.

= I can't find my login page, or the private site locked me out =

Go to yoursite.com/?swac_rescue and enter an administrator's email. You'll get the login address and a one-time link that switches off the private site, the REST API lock and the hidden login address. If email doesn't work, add `define( 'SWAC_SAFE_MODE', true );` to wp-config.php, log in at wp-login.php, fix the settings, then remove the line.

= Does deleting the plugin remove my settings? =

No, unless you select "Remove all SmartWay data when the plugin is deleted" on the SmartWay Settings tab first.

== Screenshots ==

1. The SmartWay screen: switch each extension on or off, and open its settings from the gear.
2. Access Control on a page: choose who can see it, and what everyone else sees.
3. The Access Control settings, in three sections: Basics, Whole post types and Whole site.
4. Tools → Access: check what any person can see, and why.
5. Role Manager: roles as cards, with a safe delete that can be undone.
6. Media Replace: "Replace file…" on Edit Media (and in a file's details) uploads a new version and keeps its link.
7. Media Folders: folders and subfolders beside the Media Library, with each file's details next to the files.
8. Page Order: drag pages into order or under another page, with a Move link and Undo.

== Changelog ==

= 1.0.0 =
* First public release.
* Requires WordPress 6.5 or newer.
* A new Dashboard: a short overview of what's switched on and what each extension holds, such as how many things have an access rule, how many roles and how many media folders.
* New **Page Order** extension: drag and drop pages in the Pages list to put them in order or under another page, with a Move link for the keyboard and Undo.
* New **Media Folders** extension: folders and subfolders in the Media Library and in every media window, with a list view, a Folder field in each file's details and Move to folder. One-click imports from Real Media Library, FileBird, Folders by Premio, Enhanced Media Library, Media Library Organizer and Media Library Folders.
* Access Control: a new "Logged-in users, except these roles" choice.
* Access Control: an Access column and rule box on category and tag screens.
* Access Control: Tools → Access lists everything with a rule, a page at a time, with search and filters, and points out rules that need fixing. It works on sites with thousands of rules.
* Access Control: `[smartway_restrict]` with an attribute it doesn't know hides its content from everyone, so a typo never makes content public.
* The Tools tab shows system info: each extension's version and whether it's on, and the WordPress and PHP versions.
* Every confirmation is a SmartWay popup, and settings popups open higher and wider.
* Accessibility: Media Folders works fully from the keyboard (folders open and close with the arrow keys, and focus stays in place after making or deleting a folder), and the Folder field is named for screen readers.
* Privacy: WordPress's privacy policy guide (Settings → Privacy) lists the cookies and records each extension keeps.
* On phones, the SmartWay tabs become a "Go to" dropdown, and the Dashboard, Tools, Roles and import screens fit the screen. Media folders can't be dragged by accident while scrolling on a touch screen.
* Hooks for developers to extend Access Control, Role Manager and the SmartWay screen.

= 0.9.10 =
* Security: the `[smartway_restrict]` shortcode now cleans what it shows, the way WordPress cleans post content. Scripts inside it are removed; embedded videos and form fields still work.
* Security: Role Manager checks you may change a new user's roles before applying the roles ticked on Add New User.

= 0.9.9 =
* Security: Access Control is stricter in places where restricted content could still be reached another way:
  * The hidden login address can no longer be found through other spellings of wp-login.php.
  * People who write posts can no longer read restricted posts or their comments through the REST API.
  * The comments feed and themes' live search leave out restricted posts.
  * While the site is private, WooCommerce's Store API and shop requests are closed to logged-out visitors.
  * Hidden Elementor elements no longer show up in search results or excerpts (after the page is next saved), a restricted page can't be shown inside another one with an Elementor template shortcode, and Elementor's editor opens on every page.
  * A post's access rule is no longer readable by visitors through the REST API.
* Security: the import tool reads other plugins' role lists as plain data only.
* Security: Media Replace runs other plugins' upload checks (such as SVG cleaners) on replacement files.
* Security: Role Manager stops anyone giving themselves a stronger role from the Users screen or a role's People list, refuses role names that are also capability names, and only copies or hands out roles you're allowed to give.

= 0.9.8 =
* Access Control: restricted WooCommerce products can no longer be added to the cart, and no longer appear in product shortcodes, product widgets, related products, upsells or the Store API for people who can't see them.

= 0.9.7 =
* Tidier code comments, and the internal development log is no longer included in the plugin.

= 0.9.6 =
* The plugin's description, installation steps, questions and answers, and screenshot captions are rewritten for WordPress.org.

= 0.9.5 =
* Access Control: restricted category, tag and post type pages now show their message on block themes (such as Twenty Twenty-Five) too. The posts were already hidden there, but the page showed no message.

= 0.9.4 =
* Access Control: the "Locked out?" note in the settings has the same purple edge as the other SmartWay notices.

= 0.9.3 =
* Media Replace: a "Replace file" link in the Media Library's list view, next to Edit and View. It opens the file picker straight away and replaces the file in place.

= 0.9.2 =
* Settings popups keep their rounded corners: only the middle scrolls, and the title and Save bar stay in place.
* Access Control: the settings popup is split into three folding sections (Basics, Whole post types, Whole site), each showing at a glance what is switched on.
* Media Replace: the file size and dimensions update straight away after a replace.

= 0.9.1 =
* Code cleanup ahead of the WordPress.org release: the plugin now passes the WordPress Coding Standards and WordPress.org's Plugin Check, and unused code was removed. Media Replace now saves files through WordPress's own upload and file functions. Nothing changes in how the plugin works.

= 0.9.0 =
* New Media Replace extension (off until you switch it on): a "Replace file…" button in the file's details in the Media Library, the media window and Edit Media. Upload a new version of the same type and the link stays the same, so every page using it shows the new version. Image sizes are made again, and the page cache is cleared.

= Earlier versions =
* Versions before 0.9.0 were development releases before the plugin was published.
