=== ThickGrass ===
Contributors: imstanica / Marius Stanica
Tags: helpdesk, support, ticketing, sla, knowledge-base
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A self-hosted helpdesk for WordPress: tickets, SLAs, a knowledge base, canned responses, custom intake forms, and email-based approvals.

== Description ==

ThickGrass turns any WordPress site into a complete end-user support desk. Requesters open tickets through a simple front-end portal; agents work them from a dedicated admin workbench with saved filters, SLA tracking, an activity timeline, and templated replies. Every list of values (statuses, priorities, categories, ticket types, close reasons, business hours, role permissions, email templates...) is configurable from the admin screens — nothing is hardcoded, so the plugin adapts to how your team already works instead of forcing its own vocabulary on you. All data lives in the plugin's own database tables; it does not touch WordPress core files or other plugins.

= Key Features =

* **Ticketing** — configurable ticket types with automatic numbering (e.g. `REQ-00001`, `INC-00001`), custom statuses/priorities/impact/categories, public comments vs. internal "work notes", file attachments, and a full per-ticket activity/audit log.
* **Calls (quick interaction log)** — agents log an incoming phone call, email, or walk-in in seconds, then either convert it into a full ticket or close it with a reason — the only way a ticket gets opened by staff, keeping every request traceable back to an interaction.
* **SLA management** — tracks four targets per ticket (assignment, first response, first update, resolution) against rules scoped to organization, priority, category, and ticket type, calculated using each organization's business hours, with automatic pause/resume when a ticket is on hold, a visual breach indicator, automatic escalation, and CSV-exportable SLA reports.
* **Organizations & assignment groups** — group requesters into organizations with their own business hours, and route tickets to the right team of agents.
* **Knowledge Base** — a public, no-login article library (searchable via shortcode) that agents can also insert straight into a ticket reply.
* **Canned responses** — reusable reply templates with merge fields (ticket number, title, requester name...), scoped by assignment group and/or location so agents only see what's relevant to them.
* **Custom intake forms** — build a form (text, textarea, select, checkbox, file fields) tied to a shortcode, so specific request types land as pre-filled tickets routed to the right group automatically.
* **Approvals by email** — request an approval on a ticket and let the approver say yes/no straight from an email link, no login required; the ticket moves through configurable "awaiting / approved / rejected" statuses automatically.
* **Notifications** — configurable email templates for ticket creation, status changes, replies, and SLA breaches; an IMAP inbox that automatically links a reply email back to its ticket.
* **Saved views** — agents and managers can save their own ticket filters (or share them), so the daily queue is one click away.

== Installation ==

1. Upload the `thickgrass` folder to `/wp-content/plugins/`, or install it as a zip via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin through the **Plugins** screen in WordPress. Activation seeds sensible defaults (ticket statuses, priorities, a "REQ"/"INC" ticket type, a default organization) and creates the front-end portal pages automatically.
3. Go to **ThickGrass → Setup** to review or adjust those defaults — see "How to Use" below.
4. Place the front-end shortcodes on any page (see "Front-end shortcodes" below).

By default, WordPress Administrators become ThickGrass Managers, Editors become Agents, and Subscribers become End-users. This mapping can be adjusted for your site's roles.

== How to Use ==

= Where do I find everything? =

Activating the plugin adds a **ThickGrass** item to the WordPress admin sidebar, with:

* **Dashboard** — the agent/manager workbench: the ticket queue, filters, saved views, and the ticket detail screen (status, priority, assignment, comments/work notes, attachments, activity timeline).
* **Record new Call** — log a new phone/email/walk-in interaction, and the list of calls already logged.
* **SLA reports** — SLA performance reporting with CSV export.
* **Setup** — one screen, organized into tabs, for every configurable list and CRUD entity: Assignment groups, Ticket types, Priority, Impact, Status, On-hold reasons, Call close reasons, Contact types, Custom forms, Category, Organizations, Agents, Users (end-users), Asset types, Assets, SLA definitions, Knowledge Base articles/categories, Canned responses/categories.
* **Settings** — Email inbox (IMAP) and Email templates.

= Front-end shortcodes =

Add these to any WordPress page to build your customer-facing portal:

* `[thickgrass_new_ticket]` — the "open a new ticket" form for logged-in end-users.
* `[thickgrass_my_tickets]` — a logged-in end-user's list of their own tickets, with status.
* `[thickgrass_kb]` — the public Knowledge Base search/browse page (no login required).
* `[thickgrass_custom_form slug="your-form-slug"]` — renders a custom intake form built in Setup → Custom forms.
* `[thickgrass_approval]` — the page an approver lands on when responding to an approval request from outside their inbox (used internally by the email approval flow; you generally don't need to place this manually).

= Setting up ticket types, statuses, and SLAs =

1. Go to **Setup → Ticket types** and confirm/edit the prefix, number padding, and starting number for each type (defaults: `REQ` and `INC`).
2. Go to **Setup → Status** to review the ticket lifecycle. Each status has checkboxes controlling its behavior: whether it counts as resolved, closed, on hold (pauses the SLA clock), a one-time-only state, or whether it should auto-assign the ticket to whoever moves it there.
3. Go to **Setup → Priority**, **Impact**, and **Category** to adjust the values offered on the ticket form.
4. Go to **Setup → SLA definitions** to define response/resolution targets per organization, priority, category, and/or ticket type.
5. Go to **Setup → Organizations** to set each organization's weekly business hours — SLA deadlines are calculated against these hours, not the clock.

= Logging a call and turning it into a ticket =

1. Go to **ThickGrass → Record new Call**, pick how the person reached you (phone, email, self-service, chat, walk-in), enter the requester and a short description, and save.
2. From the call, either:
   * **Convert to ticket** — choose a ticket type and requester; the full ticket form opens pre-filled with the call's details, ready to complete, or
   * **Close without a ticket** — pick a close reason (e.g. "answered by phone", "duplicate") and the call is done.

This is intentional: every ticket opened by staff traces back to a logged call, so nothing gets created out of nowhere.

= Working a ticket =

Open a ticket from the Dashboard queue to change its status, priority, or assigned agent/group, add a **public comment** (visible to the requester) or an internal **work note** (visible only to staff), attach files, insert a canned response or Knowledge Base article, or request an approval. Every change appears in the ticket's activity timeline in one chronological feed, most recent first.

= Using canned responses and the Knowledge Base =

* **Setup → Canned responses** — create reply templates with merge fields like `{ticket_number}` or `{requester_name}`; optionally scope a template to specific assignment groups and/or locations. On a ticket, pick one from the dropdown above the comment box to insert it, then choose public/work note as usual.
* **Setup → Knowledge Base articles** — write help articles with a category and tags. Insert one directly into a ticket reply, or point customers to the public `[thickgrass_kb]` page to self-serve before opening a ticket.

= Requesting an approval =

On a ticket whose type/status is flagged to allow it, use **Request approval** to email an approver a link they can act on without logging in. Approving or rejecting automatically moves the ticket to the matching configured status (and can pause its SLA via an "on hold" reason) — no manual follow-up needed.

= Setting up email notifications =

* **Settings → Email templates** — edit the subject/body (with placeholders) sent on ticket creation, status changes, new replies, and SLA breaches.
* **Settings → Email inbox (IMAP)** — point ThickGrass at a mailbox it should poll (every 5 minutes) so replies sent by email are automatically matched back to the right ticket by its `[Ticket #N]` subject tag.

== Frequently Asked Questions ==

= Does this require any other plugin or theme? =

No. ThickGrass works with any theme and does not depend on any other plugin. All data lives in its own `wp_thickgrass_*` database tables; it never modifies WordPress core files, core tables, or other plugins.

= Why can't agents open a ticket directly from the admin dashboard? =

By design, every ticket created by staff must trace back to a logged interaction. An agent records a **Call** (phone, email, self-service, chat, or walk-in) and then either converts it into a ticket or closes it with a reason. Tickets can also be opened directly by end-users through the `[thickgrass_new_ticket]` front-end form. This keeps every request traceable to how it actually reached your team.

= Do end-users need an account to open a ticket? =

Yes, to open or track a ticket a visitor must be logged in (mapped to the "End-user" role by default). The Knowledge Base (`[thickgrass_kb]`) and the email approval landing page are the only parts of the plugin that work without a login.

= Can I customize the statuses, priorities, and other dropdown values? =

Yes. Statuses, priorities, impact, categories, ticket types, close reasons, and contact types are all managed from **ThickGrass → Setup**. Nothing is hardcoded, so you can rename, add, or deactivate values to match your own workflow.

= Can I connect more than one mailbox for the email inbox (IMAP)? =

Not yet in this version — **Settings → Email inbox** supports a single monitored mailbox. It automatically matches incoming replies to existing tickets by their `[Ticket #N]` subject tag; it does not currently create new Calls from unrecognized senders.

= Is there a REST API? =

Not in this version. The plugin currently uses classic WordPress admin-post form handling rather than a public REST API.

= Is ThickGrass translation-ready? =

Yes, all strings go through WordPress's standard `__()`/`_e()` functions under the `thickgrass` text domain, and a `/languages` folder is bundled for translation files. A ready-made `.pot` file is not included yet.

== Screenshots ==

1. Agent workbench — ticket queue with filters and saved views.
2. Ticket detail screen — status, priority, assignment, comments/work notes, and activity timeline.
3. SLA definitions and CSV-exportable SLA reports.
4. Front-end Knowledge Base search.

== Changelog ==

= 1.0.0 =
* Initial release: ticketing with configurable types/statuses/priorities/categories, Calls, SLA management with business hours and escalation, Organizations and assignment groups, saved views, Knowledge Base, canned responses, custom intake forms, email notifications, IMAP reply matching, and email-based approvals.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
