=== LucrativeIt Support Ticket Plus ===
Contributors: lucrativeit
Tags: support, tickets, helpdesk, customer support, knowledge base
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 8.2
Stable tag: 1.1.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Help desk and ticket management for WordPress by LucrativeIt.com.

== Description ==

LucrativeIt Support Ticket Plus is a production-ready WordPress plugin for managing customer support requests from creation through resolution.

**Live demo / support portal:** https://wpticket.lucrativeit.com/lucrativeit-support-ticket-plus/

**Features:**
* Auto-generated ticket numbers with SLA tracking
* Seven status states and four priority levels
* Department-based auto-assignment with round-robin load balancing
* Public replies and internal notes
* Secure file attachments
* In-app notifications
* Permission management built on your existing WordPress roles (no extra roles created)
* User and department management
* SMTP email configuration
* 11 customizable email notification templates
* Public knowledge base
* Reports dashboard

**Optional Pro add-on (separate plugin, not required):** email-to-ticket webhook, Gmail inbound polling, AI reply suggestions, and Google login.

**Author:** LucrativeIt.com(zahiislink@gmail.com)

== Installation ==

1. Upload the plugin to `/wp-content/plugins/lucrativeit-support-ticket-plus/`
2. Activate through the **Plugins** menu in WordPress admin
3. Go to **Support Ticket Plus → Settings** to configure SMTP, departments, and roles
4. To let customers sign up themselves, go to **Settings → General** and enable **Membership → "Anyone can register"**
5. Open the customer-facing support portal (see **Frontend portal page** below)

== Frontend portal page ==

Customers and agents use a WordPress **page** on your site that contains a shortcode. The plugin creates this page automatically on activation.

= Automatic setup (recommended) =

On first activation, the plugin publishes a page titled **Support Portal** with this shortcode:

`[lucrativeit_support_portal]`

1. Go to **Pages → All Pages** in WordPress admin
2. Find **Support Portal** and click **View** to open the frontend
3. Add the page to your site menu (**Appearance → Menus**) so customers can find it

Logged-in users see the ticket dashboard. Visitors who are not logged in see a login prompt (or registration link if enabled under **Support Ticket Plus → Settings → Auth**).

= Manual setup =

If the portal page was deleted or you want a custom URL/slug:

1. Go to **Pages → Add New**
2. Enter a title (e.g. *Support*, *Help Center*, or *My Tickets*)
3. In the page content, add this shortcode:

`[lucrativeit_support_portal]`

4. Click **Publish**
5. Optional: set a short slug such as `support` or `help` under **Permalink**
6. Add the page to your navigation menu

The plugin stores the page ID automatically when it creates the page. If you create your own page manually, ticket links and email notifications work best when that page uses the `[lucrativeit_support_portal]` shortcode.

= Knowledge base shortcode (optional) =

To show only the knowledge base on any page (without the full portal):

`[lucrativeit_knowledge_base]`

You can also open the knowledge base inside the portal at:

`yoursite.com/lucrativeit-support-ticket-plus/?lit_view=knowledge-base`

(Replace the path with your portal page slug.)

= Portal URL examples =

The portal page is created with the slug `lucrativeit-support-ticket-plus`:

* Dashboard: `https://yoursite.com/lucrativeit-support-ticket-plus/`
* My tickets: `https://yoursite.com/lucrativeit-support-ticket-plus/?lit_view=tickets`
* Create ticket: `https://yoursite.com/lucrativeit-support-ticket-plus/?lit_view=create`
* View ticket #12: `https://yoursite.com/lucrativeit-support-ticket-plus/?lit_view=ticket&lit_ticket=12`
* Notifications: `https://yoursite.com/lucrativeit-support-ticket-plus/?lit_view=notifications`

Staff with agent permissions see the same portal with additional options (assign tickets, internal notes, etc.).

== Roles & permissions ==

This plugin does **not** create its own WordPress roles. Instead, you grant the plugin's permissions to the WordPress roles you already use.

= How it works =

* **Every logged-in user is a customer by default** — they can create and view *their own* tickets and see their dashboard automatically, with no permission required.
* Go to **Support Ticket Plus → Roles** to see a grid of your existing WordPress roles (Administrator, Editor, Author, Subscriber, custom roles, etc.) with a checkbox for each *staff* permission: Tickets, Users, Roles, Departments, Reports, Settings, and Knowledge Base.
* Tick the permissions a role should have and click **Save Permissions**.
* **Administrators always have full access** and cannot be changed on this screen.
* The **Tickets** permission grants *staff* access — the ability to see, manage, and be assigned **all** tickets. Roles without it remain customers who only see their own tickets.

= Defaults =

Until you save the Roles screen, staff-capable roles (Editor, Author, Contributor, and any custom roles) are granted the **Tickets** permission by default. **Subscriber is excluded on purpose** so that front-end registrants stay customers — they can still create and view their own tickets and use their dashboard, they just can't see other people's tickets. Grant a role the Tickets permission to make it support staff.

= Front-end registration =

Visitors who register from the front end use the same flow as **wp-login.php?action=register**: they choose a username and email, WordPress validates the signup, emails login details, and does not log them in automatically. New accounts are assigned the **Subscriber** role and treated as customers. Accounts created from the WordPress admin keep whatever role the administrator selects.

**Important:** For front-end registration to work, WordPress must allow new sign-ups. Go to **Settings → General** and enable the **Membership → "Anyone can register"** checkbox. If this is disabled, the WordPress registration form (used by the portal's Register link) will reject new accounts.

== Frequently Asked Questions ==

= How do I make someone a support agent? =

Go to **Support Ticket Plus → Roles** and grant the **Tickets** permission to the WordPress role that user has (for example, Editor). Alternatively, change the user's WordPress role to one that already has the Tickets permission. There is no separate "support role" to assign.

= Will users who register on the front end be able to see other people's tickets? =

No. Front-end registrants get the **Subscriber** role, which is not granted the staff **Tickets** permission, so they are customers who can only create and view their own tickets and use their dashboard. To turn a user into staff, grant the Tickets permission to their WordPress role on **Support Ticket Plus → Roles** (or move them to a role that has it).

= How do I show the support portal on my site? =

Add the `[lucrativeit_support_portal]` shortcode to any WordPress page. On activation, a **Support Portal** page is created for you. See **Frontend portal page** under Installation.

= What is the email webhook URL? =

Install the optional **Lucrative Support Ticket Pro** add-on, then go to **Support Ticket Plus → Settings → Email Ticketing**. The REST endpoint and webhook secret are shown there.

= Does Gmail inbound require a cron job? =

With the Pro add-on, WP-Cron polls Gmail every minute by default. For production, set a real server cron hitting `wp-cron.php`.

== Changelog ==
= 1.1.7 =
  Initial update

= 1.1.6 =
* Security: removed the in-plugin user create/edit/delete handlers entirely; account lifecycle is delegated to WordPress core (Users screen) so `create_users`, `promote_users`, and `edit_users` checks always apply.
* Security: `assign_role()` no longer modifies WordPress core roles and only accepts known plugin role slugs stored in user meta.
* Security: the Roles & Permissions screen and permission map updates now require `manage_options`.

= 1.1.5 =
* Security: fixed a privilege-escalation risk and hardened account/role handling — the plugin assigns permissions to existing WordPress roles instead of creating or granting core roles.
* Added front-end AJAX login and registration on the support portal (modal), so customers no longer go to the WordPress admin to sign in.

= 1.1.4 =
* Maintenance release: minor bug fixes and stability improvements
* Verified compatibility with the latest WordPress release

= 1.1.3 =
* Renamed plugin to LucrativeIt Support Ticket Plus
* Changed the support portal permalink to `lucrativeit-support-ticket-plus` (page slug and pretty-URL rewrite base)
* Resolved Plugin Check errors: all custom-table queries now use `$wpdb->prepare()` with `%i` identifier placeholders, output escaping, and translators comments
* Removed the discouraged manual `load_plugin_textdomain()` call (translations load automatically)
* Bumped minimum WordPress to 6.2 (required for the `%i` placeholder) and tested up to WordPress 7.0

= 1.1.2 =
* Renamed plugin to LucrativeIt Help Desk and Ticket Manager (slug: lucrativeit-help-desk-ticket-manager)
* Email template customization fully enabled in the free plugin
* Removed trialware / Pro upsell locks from core functionality
* Front-end attribution is now opt-in via Settings
* Attachment downloads now require a nonce
* Tested up to WordPress 6.9

= 1.1.1 =
* Internal note visibility fixes, ticket URL fixes, attachment display, Pro feature split

= 1.0.0 =
* Initial release
