Hi, I'm building a ticketing system using custom post type for the ticket, custom field to hold the ticket's status, CRED for displaying the submission form, and native WordPress comment for responses (with additional plugin to enable attachment in comment section).
At the moment there is no frontend form for editing submitted tickets. But occasionally administrators can manually edit ticket's title and/or description from the backend for clarity.
Now I need to display ticket's history on its single page template that includes the time, the user, and the action given to the ticket. The actions would be:
- submission, when the ticket was submitted
- edit, when manually edited
- status change, when changed, for example, from New to Progress, or from Progress to Closed
- optionally, comments, when submitted
The desired output would be similar to this:
[user 1] created this ticket at [time]
[user 2] edited this ticket at [time]
[user 3] set this ticket to 'Progress' at [time]
[user 3] submitted a comment at [time]
[user 1] submitted a comment at [time]
[user 1] set this ticket to 'Closed' at [time]
What's the best way to do it? Do I use hooks in combination with repeatable field groups that adds an entry every time the ticket is saved? Do I need another post type?
Hello. Thank you for contacting the Toolset support.
I would say you may create a new post type "Ticket Action Log" and add few fields to it like time, status (New, Progress, Close) and a field to store the user id.
And later on use views to display your ticket history.
Would you mind telling me why you recommend a post type as opposed to repeatable field groups within the existing post type?
=> Well - when you use post type it will give you more control when you want to display related content and also it will allow you to filter the results whereas when you use repeatable fields group there is the limitation.