=== Clicks User Manager ===
Contributors: sykologicist, freemius
Tags: user management, woocommerce customers, export users, bulk email, user filter
Requires at least: 5.9
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage, filter, and export WordPress users in bulk. Filter by role, activity, and WooCommerce orders. Bulk delete, edit roles, email, or export.

== Description ==

**Clicks User Manager** adds a complete user management dashboard to your WordPress admin — built for site owners, agencies, and store managers who need more control over their user base than the default Users screen provides.

Filter your entire user list by role, registration date, last login activity, inactivity period, post count, and — for WooCommerce stores — by order history. Then act on the results: bulk delete, change roles, send a bulk email, or export everything to CSV.

= Key Features (Free Version) =

* **Advanced User Filters** — Filter by role, registration date range, last login (today / this week / this month / never), inactivity (30 / 60 / 90 days), post count, and free-text search across username, email, and display name.
* **WooCommerce Order Filters** — Filter users by order history: customers who have ordered, customers with zero orders, or by order-count ranges (1 order, 2–5 orders, 6+ orders). An "Orders" column shows each user's lifetime order count.
* **Sortable, Paginated User Table** — Sort by username, email, role, registration date, last login, or post count. Choose 20, 50, or 100 users per page.
* **Bulk Delete with Confirmation** — Select multiple users and delete them safely with a confirmation modal. The currently logged-in admin account is always protected.
* **Bulk Role Change** — Change the WordPress role of multiple selected users in one action.
* **Bulk Email (Bulk Mail)** — Compose a subject and message and send to all selected users via WordPress's built-in `wp_mail()`. Supports personalisation tokens: `{first_name}`, `{last_name}`, `{username}`, `{email}`.
* **CSV Export with Custom Columns** — Export all users or a filtered subset to CSV. Choose exactly which columns to include.

= Unlock Clicks User Manager Pro =

Take user management to the next level with our premium features:

* **User Notes** — Keep team notes on user profiles. The free version allows up to 3 notes per user, while Pro offers unlimited notes plus a bulk note addition utility.
* **Smart Segments** — Save your current filter configurations as templates for one-click reloading. Gated at 1 saved segment in Free, unlimited in Pro.
* **Quick-Edit Drawer** — A slide-out panel to edit core fields (Name, Email, Display Name, Role). Pro unlocks adding and editing custom user metadata fields directly.
* **Login Impersonation (Login As User)** — Securely switch session to any user to see the site from their perspective. Free is limited to 3 impersonations per month, Pro has unlimited impersonations and a floating switch-back banner.
* **Advanced Filters** — Filter by custom user meta keys/values, WooCommerce lifetime spent (LTV), average order value (AOV), and custom login date ranges.
* **Scheduled CSV Exports** — Automatically run exports daily, weekly, or monthly, and send them to an email address or post to a Webhook URL.
* **Personalised Bulk Emails** — Email users with advanced personalization tokens like `{registration_date}`, `{last_login_date}`, `{wc_total_spent}`, `{wc_order_count}`, `{wc_last_order_date}`, and `{meta:custom_meta_key}`.
* **Interactive Dashboard Charts** — Beautiful responsive inline SVG trend graphs (registration activity over time) and activity breakdown stacked charts.

= Free vs. Pro Feature Comparison =

Feature | Free | Pro
--- | --- | ---
Advanced Filters | Role, Registration, Basic WooCommerce | Custom Meta, WC LTV & AOV, Custom Login Date Ranges
User Notes | Max 3 notes per user | Unlimited notes + Bulk Add Notes
Smart Segments | Save 1 segment template | Save unlimited segments
Quick-Edit Drawer | Core account fields | Core fields + Custom Meta key/value editor
Login Impersonation | Max 3 sessions per month | Unlimited sessions + Front-end switch-back bar
Bulk Email Personalisation | Basic tokens ({first_name}, {last_name}, etc.) | Basic + Advanced tokens (WooCommerce spending, login dates, custom meta)
Scheduled Exports | Manual CSV exports only | Automate daily/weekly/monthly via Email or Webhook
Dashboard Analytics | Text KPIs and role list bars | Interactive SVG line & bar trend charts

Developed by [Clicks.com.pk](https://clicks.com.pk)

== Installation ==

1. Download the plugin zip file.
2. In your WordPress admin, navigate to **Plugins → Add New → Upload Plugin**.
3. Upload the zip file and click **Install Now**.
4. After installation, click **Activate Plugin**.
5. A new **Clicks User Manager** menu item will appear in the left-hand admin sidebar.

= Manual Installation =

1. Unzip the plugin file.
2. Upload the `clicks-user-manager` folder to your `/wp-content/plugins/` directory via FTP.
3. Activate the plugin in **Plugins → Installed Plugins**.

== Frequently Asked Questions ==

= Does this plugin delete users permanently? =

Yes. Bulk deletion is permanent and cannot be undone. The plugin always shows a confirmation modal before deletion so you cannot delete users accidentally.

= Can I delete my own admin account with this plugin? =

No. The currently logged-in admin account is always excluded from bulk delete operations for safety.

= How does Last Login tracking work? =

The plugin hooks into WordPress's built-in `wp_login` action and saves a timestamp to user meta (`_wpum_last_login`) each time a user logs in. Users who logged in before the plugin was activated will show "Never" until they log in again.

= Does the bulk mail use an external SMTP service? =

No. All emails are sent using WordPress's native `wp_mail()` function. You can improve deliverability by installing an SMTP plugin such as WP Mail SMTP, but this plugin requires no external service itself.

= What file format is the export? =

Users are exported as a UTF-8 CSV file (with BOM for Excel compatibility) named `users-export-YYYY-MM-DD.csv`.

= Is the plugin multisite compatible? =

The plugin is designed for single-site installations. Multisite compatibility is planned for the Pro version.

= Will this plugin slow down my site? =

No. All plugin functionality is loaded only in the WordPress admin and only on the plugin's own pages. There is zero front-end overhead.

= Do I need WooCommerce to use this plugin? =

No. WooCommerce is completely optional. If WooCommerce is not active, the plugin works exactly as described above without the order-related filters and column. If WooCommerce is active, an "Orders" column and a WooCommerce order filter (Has Ordered / No Orders / order-count ranges) automatically appear — no configuration needed.

= How is the WooCommerce order count calculated? =

The plugin counts each customer's orders directly from WooCommerce's order storage (compatible with both legacy and High-Performance Order Storage / HPOS), excluding trashed and draft orders. Counts are cached for 5 minutes and refresh automatically whenever an order is created or its status changes.

== Screenshots ==

1. User management table with filters and bulk actions.
2. Bulk email compose modal.
3. Delete confirmation modal.
4. CSV export page with column selector.
5. Dashboard stats widget.
6. About page.

== Changelog ==

= 1.2.0 =
* New: Premium version officially launched with Freemius SDK integration.
* New: Added Pro Upsell banners in the free version.
* New: Full Pro feature integration (User Notes, Smart Segments, Quick-Edit drawer, Login Impersonation, Advanced filters, Scheduled exports, Personalisation mail variables, Dashboard stats charts).
* Improvement: Cleaned up promotional placeholder banners and replaced them with checkout upgrade links.

= 1.1.0 =
* New: WooCommerce order filter — filter users by "Has Ordered", "No Orders", or order-count ranges (1, 2–5, 6+).
* New: "Orders" column in the user table showing each customer's lifetime order count, linked to their orders.
* New: "Order Count" column available in CSV export when WooCommerce is active.
* New: WooCommerce order filter added to the Export Users page.
* Improvement: Order counts are cached and automatically refreshed on order changes.
* All WooCommerce features are optional and only appear when WooCommerce is active.

= 1.0.0 =
* Initial release.
* User table with advanced filters (role, date range, last login, inactive, post count, search).
* Bulk delete with confirmation modal.
* Bulk role change.
* Bulk email via wp_mail with personalisation tokens.
* CSV export with custom column selector.
* Last login tracking via wp_login hook.
* Dashboard stats widget with role bars.
* About page with developer credits.

== Upgrade Notice ==

= 1.2.0 =
Premium version officially launched with Freemius SDK integration. All users can now upgrade to Clicks User Manager Pro.

= 1.1.0 =
Adds optional WooCommerce order filters and an Orders column. No action needed — these only appear if WooCommerce is active.

= 1.0.0 =
Initial release. No upgrade steps needed.

== Developer ==

Clicks User Manager is developed and maintained by **Clicks**.

* Website: [https://clicks.com.pk](https://clicks.com.pk)
* Contact: [https://clicks.com.pk/contact](https://clicks.com.pk/contact)
