=== HU Challenge ===
Contributors: healthunlimited
Tags: fitness, challenge, leaderboard, gamification
Requires at least: 6.2
Tested up to: 7.1
Stable tag: 1.1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create member fitness challenges with saved activity, configurable yard values, seasonal themes, and a public leaderboard.

== Description ==

HU Challenge provides a self-contained fitness challenge experience inside WordPress.

The plugin includes:

* Front-end participant registration and login.
* First name, last name, email, password, and optional public display name.
* Configurable challenge tasks, yard values, daily or weekly limits, and motivational descriptions.
* Saved participant activity and an overall leaderboard based on total yards.
* A football theme with a 100-yard drive visualization, touchdowns, and score.
* A three-day consistency bonus based on activity logged on three different days from Monday through Sunday.
* Recent activity history and a short undo window for accidental entries.
* Password reset by email using WordPress mail.
* Administrator views for challenge setup, participants, leaderboard standings, and activity history.
* A Classic theme that can be used as a base for other challenge concepts.

HU Challenge stores data locally in the WordPress database and does not contact external services.


= Source code and build process =

HU Challenge does not use npm, webpack, a transpiler, a minifier, or any other JavaScript/CSS build tool. The files distributed in `assets/` are human-readable source files loaded directly by WordPress.

For clarity, the JavaScript source is also included at `src/hu-challenge.js`. It is the same source used by the distributed front-end script and requires no compilation or build command.

= Challenge seasons =

The configured challenge start date is used as the scoring-season identifier. Changing the start date begins a new leaderboard and activity season while preserving prior-season records in the database.

= Privacy =

HU Challenge creates restricted WordPress user accounts for participants and stores participant first name, last name, email address, optional display name, and challenge activity history in the WordPress database.

The participant display name and total yards are shown on the public challenge Scoreboard. If no display name is provided, the plugin uses the participant's first name and last initial.

Site administrators can view participant names and activity history for challenge administration and prize fulfillment. The plugin does not send participant data to external services.

HU Challenge registers with the WordPress Personal Data Export and Erase tools so challenge activity can be included in privacy requests.

== Installation ==

1. Upload the `hu-challenge` folder to `/wp-content/plugins/`, or install the plugin ZIP through Plugins > Add New > Upload Plugin.
2. Activate HU Challenge.
3. Create or edit a WordPress page and add the shortcode `[hu_challenge]`.
4. Open HU Challenge > Challenge Setup to set the challenge name, tagline, dates, and theme.
5. Review the starter activities under HU Challenge and edit the yard values, limits, descriptions, or motivational text as needed.
6. Publish the page containing the shortcode.

== Frequently Asked Questions ==

= Do participants need normal WordPress accounts? =

No. Participants create an account from the challenge page. The plugin creates a restricted WordPress account behind the scenes and keeps the challenge login experience on the front end.


= Where do administrators manage challenge participants? =

Use HU Challenge > Participants. Challenge-only accounts are hidden from the normal Users > All Users list to keep the site's user-management screen focused on administrative/editorial accounts. WordPress authentication is still used securely behind the scenes.

The Participants screen shows each participant's real name, public display name, email address, current-season yards, drawing entries, last activity, and registration date. Administrators can also edit a participant's public display name there.

= When does the weekly challenge period reset? =

Weekly limits and the 3-Day Consistency Bonus use a Monday-through-Sunday week in the WordPress site's configured timezone. The new week begins Monday at 12:00 a.m.

= What is shown on the public leaderboard? =

Only the participant display name and total yards. Full names and email addresses are available only to site administrators through WordPress.

= Does the plugin send data to another service? =

No. Challenge data is stored in the site's WordPress database. Password-reset messages are sent through the site's normal WordPress mail configuration.

= How do daily and weekly limits work? =

Each challenge task can be configured as one-time, daily, weekly, or unlimited, with a maximum number of units for that period.

= What happens when I change the challenge start date? =

The start date identifies the current scoring season. Changing it begins a new leaderboard without deleting prior-season activity from the database.

= Does deactivating or deleting the plugin delete participant data? =

No. Challenge data is intentionally retained so accidental deactivation does not erase participant history. Site administrators can use WordPress privacy tools to erase an individual participant's challenge activity.

== Changelog ==

= 1.1.0 =
* Added HU Challenge > Participants for challenge-member administration.
* Challenge-only accounts are hidden from the normal WordPress Users list while continuing to use WordPress authentication securely behind the scenes.
* Added participant totals, prize-drawing entry counts, last activity, registration dates, and direct activity-history links.
* Added administrator editing of participant public display names.
* Defined weekly limits and the 3-Day Consistency Bonus as Monday through Sunday, resetting Monday at 12:00 a.m. in the site timezone.
* Updated consistency-bonus member copy to explain the Monday-Sunday week.

= 1.0.4 =
* Added a dedicated `hu_challenge_participate` capability for participant-only REST API access.
* Restricted participant state, activity logging, and undo endpoints to challenge participants and administrators.
* Added bundled, human-readable front-end JavaScript source and documented that no build tools are required.

= 1.0.3 =
* Added an administrator-controlled Active/Inactive challenge status.
* Challenge dates now define/display the season but do not automatically disable activity logging.
* Fixed the recent-plays query formatting.

= 1.0.1 =
* Improved WordPress.org compatibility for custom-table queries and Plugin Check compliance.

= 1.0.0 =
* Production-ready initial release.
* Added GPL licensing metadata and WordPress.org readme documentation.
* Added public-request nonce validation for front-end account actions.
* Restricted challenge login and password-reset flows to challenge members and administrators.
* Added WordPress Personal Data Export and Erase integration.
* Added privacy-policy helper text.
* Added scoring seasons keyed to challenge start date so future challenges do not mix leaderboard totals.
* Preserved administrator-edited starter tasks during plugin upgrades.
* Added challenge-date enforcement for activity logging.
* Kept total yards as the leaderboard score and Score as the secondary football statistic.
