===  AddonLogic Last Active Timestamp ===
Contributors: snehalpancholi
Tags: last active, user activity, user tracking, online status, timestamp
Requires at least: 6.0
Tested up to: 6.7
Stable tag: 1.0.0
Requires PHP: 8.1
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Track and display when each user was last active — with a Users column, a shortcode, and a template tag.

== Description ==

AddonLogic Last Active Timestamp records a Unix timestamp to user meta each time a logged-in user loads a frontend page. The timestamp updates at a configurable throttle interval to keep database writes minimal.

**Features:**

* Automatic activity tracking on every frontend page load
* Throttled writes — configurable 1–60 minute intervals
* **Admin Users column** sortable by last-active time (hover for absolute date)
* **`[last_active]` shortcode** — shows current user's time; `user_id="X"` for any user
* **`format="human|absolute"` attribute** — "3 hours ago" or "June 15, 2026 3:45 pm"
* PHP template tag `addlc_lat_get_last_active( $user_id )` for theme use
* No frontend assets — zero impact on page load
* Uninstall removes all user meta cleanly

== Installation ==

1. Upload `last-active-timestamp` to `/wp-content/plugins/`.
2. Activate via the **Plugins** screen.
3. Go to **Settings > Last Active** to configure throttle interval and display format.
4. The **Last Active** column appears automatically in **Users > All Users**.

== Shortcode Usage ==

Display for the current logged-in user:
`[last_active]`

Display for a specific user:
`[last_active user_id="42"]`

Force absolute format:
`[last_active format="absolute"]`

== Template Tag ==

```php
// In theme templates
echo addlc_lat_get_last_active( get_the_author_meta('ID') );
echo addlc_lat_get_last_active( get_the_author_meta('ID'), 'absolute' );
```

== Frequently Asked Questions ==

= Does tracking fire on AJAX and cron requests? =
No. Tracking is skipped for AJAX (`wp_doing_ajax()`) and cron (`wp_doing_cron()`) requests.

= What does the throttle interval do? =
It limits database writes per user. If the interval is 5 minutes, the meta is only updated once every 5 minutes per user, regardless of how many pages they load.

= Is admin panel activity tracked? =
No. Only frontend page loads are tracked (admin requests fire before `init` reaches the tracking hook via the standard WP request flow, and admin users often reload pages frequently).

== Changelog ==

= 1.0.0 =
* Initial release.
