=== MasonTrail ===
Contributors: sanusilam
Tags: construction, client portal, project management, milestones
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A construction client portal for WordPress. Share project progress, milestones and updates with assigned clients.

== Description ==
MasonTrail is a construction client portal for WordPress. Administrators manage projects, client accounts, milestones and progress updates in the WordPress admin. Assigned clients sign in to a front-end portal page to see only their live projects.

Project records, client accounts and media stay on your WordPress site. This plugin does not call external APIs, load remote assets, or collect analytics.

= Workspace =
* Overview of live, draft and completed projects, with recent project cards.
* Projects with a name, dates, status (not started, in progress, on hold, completed), completion percentage, draft or live visibility, and one assigned client.
* Up to 50 milestones per project, each with a title, date and status. Open a project from its name or Add milestones on the project card.
* Search and filter projects, then edit a project, preview the client view, post an update, or delete it.
* Color-coded status pills for draft, published and project statuses.
* Clients as WordPress users. Add a name and email; WordPress generates a password. Copy it once from Client sign-in details. It cannot be retrieved later. Reset existing passwords under Users or with the portal’s lost-password link.
* Progress updates written from a project. Choose the project and draft or published visibility, add formatted text, then attach up to 12 JPEG, PNG, WebP or GIF photos from the Media Library.
* After a successful save, you return to the updates list with a green confirmation. Failed saves stay on the form with a red error notice.
* Setup & help to create a portal page or select an existing published page that contains `[masont_portal]`.

= Client portal =
* A public page containing `[masont_portal]`. Guests are asked to sign in.
* Assigned clients see progress, dates, milestones and published updates with a photo gallery.
* Clients with more than one live project can switch between them.
* Portal clients cannot use wp-admin. Administrators can open a read-only preview of the client view from a project.

= Privacy =
Photos selected from the Media Library remain reachable by anyone who has the file URL. Do not attach contracts, plans, IDs or confidential site photos. WordPress privacy tools can export assigned MasonTrail records and unassign a client.

= Compatibility =
MasonTrail uses the unique `masont_` prefix for classes, constants, stored data, roles, actions and assets. Version 1.0.4 automatically migrates existing FieldCore / BuildNarra / Construction Client Portal records in bounded, resumable batches. Project and update IDs, content, assignments, photos and existing client accounts are preserved. Legacy metadata and options are retained for reference; downgrading requires restoring the pre-upgrade database backup. Existing `[fieldcore_portal]`, `[buildnarra_portal]` and `[ccp_client_portal]` shortcodes remain supported only as compatibility aliases; use `[masont_portal]` for new pages. The `fieldcore.php` entry filename is retained so WordPress recognizes an update to an existing installation.

== Installation ==
1. Back up your WordPress files and database.
2. If installed, deactivate FieldCore, BuildNarra or Construction Client Portal first. Do not run them alongside MasonTrail. Existing records are migrated automatically; existing portal page content does not need replacement.
3. Upload the plugin through Plugins → Add New → Upload Plugin, then activate MasonTrail.
4. Open MasonTrail → Setup & help. Create a portal page or select a published page containing `[masont_portal]`.
5. Existing projects, client accounts, settings and portal pages are retained. Legacy portal shortcodes remain supported. On larger installations, reload the workspace until the migration finishes before editing records.
6. Create a client (copy the generated password), create a project and assign that client, then post an update from the project. Sign in as that client in a private browser window to verify access.

== Frequently Asked Questions ==

= Who can use the MasonTrail workspace? =
WordPress administrators receive the MasonTrail capability on activation. This release does not add a setting to grant that capability to editors or other roles. Portal clients can only view their assigned live projects on the portal page.

= How do I post a project update? =
Open Projects, then choose Post update on the project card. Write the update, choose Draft or Published, add photos if needed, and save. You return to the updates list. Open an existing update from that list to edit or delete it.

= How do I add milestones? =
Open Projects and choose the project name or Add milestones. That opens the project editor at the milestones section.

= How do client passwords work? =
On Clients, enter a name and email, then create the account. WordPress generates a password. Copy it from Client sign-in details before leaving the page. The generated password is held temporarily in an administrator-specific transient for up to five minutes and deleted when the next workspace page displays it. WordPress stores the account password as a hash. Previously created passwords cannot be recovered; reset them under Users → that person, or use the portal’s lost-password link.

= Are progress photos private? =
No. Photos come from the WordPress Media Library and remain reachable by anyone who has the file URL. Do not attach contracts, plans, IDs or confidential site photos.

= How do I export or erase a client’s MasonTrail data? =
Use Tools → Export Personal Data and Tools → Erase Personal Data with the client’s email. Export includes assigned project text, dates, progress, milestones and all related updates with photo URLs, including draft and trashed records. Erase unassigns that person and sets live or scheduled projects to draft. Project text and Media Library photos stay on the site until an administrator deletes them.

= What happens if I delete the plugin? =
Deactivation and uninstall keep projects, updates, client accounts, photos and settings. Delete a project or update from its edit screen if you no longer need it. Client accounts are WordPress users and can be managed under Users.

= Does this plugin work on Multisite? =
Network-wide activation is blocked. You may activate it on individual sites. New clients are added to the current site. Client access requires membership of the current site. Account passwords are WordPress network-wide credentials; duplicate network email addresses are not overwritten. Site administrators need WordPress permission to create or edit users.

= Will the portal work with a page cache? =
Exclude the portal page and all of its query strings from page/CDN caching. Never cache logged-in portal responses.

== Privacy and operation ==
Project text requires sign-in and project assignment. Media Library photos remain public through their direct URLs. Exclude the portal page from page/CDN caching. WordPress privacy tools can export assigned MasonTrail records and unassign a client; they do not delete the administrator’s project files.

== Changelog ==

= 1.0.4 =
* Use operation-specific nonces and enforce permissions on portal setup and page selection.
* Sanitize request fields and retained form values; reject malformed nested input.
* Adopt the unique masont_ prefix with resumable migration of existing records and legacy shortcode compatibility.
* Scope conflict notices to the Plugins and MasonTrail screens and make them dismissible.
* Correct the contributor username to sanusilam and clean the distribution archive.

= 1.0.3 =
* Displayed update photos in three columns on desktop, with fewer columns on small screens.
* Simplified the update editor: choose project and visibility first, then write, attach photos and save.
* After saving an update, return to the updates list with a green success notice or stay on the form with a red error notice.
* Skipped incomplete Media Library selections so a newly uploaded photo no longer appears as a broken duplicate thumbnail.
* Post updates from a project card instead of a separate Write an update button.
* Added an Add milestones action on project cards.
* Color-coded status pills for draft, published and project statuses.
* Generate a client password on save and show it once; removed in-workspace password fields and reset buttons.
* Create clients with the same form POST flow as projects and updates.
* Styled primary, secondary, danger and text links with distinct colors.
* Removed the milestone eyebrow and the overview launch checklist panel.
* Removed update email notifications, notification controls and retry actions from this edition.
* Improved workspace and portal widths and restored button text contrast.
* Added a navy-and-amber architectural logo in the workspace and a matching WordPress admin menu icon.
* Rebranded the plugin as MasonTrail with the masontrail translation domain; existing code interfaces and stored data remain compatible.
* Updated author and contributor attribution to Slamido.
* Completed privacy exports without update truncation and removed the silent erasure limit.
* Hardened role/membership checks, same-site redirects, client password validation and destructive actions.
* Fixed failed-form checkbox/milestone recovery and provided bounded client assignment search.
* Included trashed updates in project deletion, retained parent records after deletion errors and protected write/delete conflicts.
* Added deletion confirmation without JavaScript and clearer scripting requirements.
* Prepared the plugin for the WordPress.org directory: readme, license, translations and unused assets.
* Added project and update deletion, a portal page dropdown, and a client wp-admin lock.
* Added WordPress privacy export and erase for assigned projects.
* Added new portal clients to the current Multisite site and stopped forcing a fixed portal width.
* Simplified workspace chrome: sentence-case labels, no version chip, and an overview hero that hides after setup.

= 1.0.2 =
* Removed redundant portal header branding.
* Replaced the overview artwork with a construction site drawing.

= 1.0.1 =
* Stopped using the full-size brand PNG as the WordPress admin menu icon, which overflowed the dashboard.
* Restyled the workspace and client portal to black and white, with a subtle grid on dark surfaces.

= 1.0.0 =
* Renamed the plugin and workspace to FieldCore (the previous product name).
* Added the official PNG brand icon.
* Changed the client password label to Set password.
* Added automatic password generation and copying after creation/reset.
* Added confirmed password regeneration for existing clients.
* Removed password invitation controls and sending code.
* Preserved existing records and legacy portal shortcodes.
