JS Support Ticket Shortcodes

Below, you’ll find a detailed guide on how to add the JS Support Ticket Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Js Support Ticket Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the JS Support Ticket Plugin and the shortcodes it provides:

Plugin Icon
JS Help Desk – Best Help Desk & Support Plugin

"JS Help Desk – Best Help Desk & Support Plugin is a comprehensive tool for managing customer service inquiries. Its advanced features streamline support ticketing, enhancing user experience."

★★★☆✩ (62) Active Installs: 5000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [jssupportticket]
  • [jssupportticket_addticket]
  • [jssupportticket_addticket_multiform]
  • [jssupportticket_mytickets]

JS Support Ticket [jssupportticket] Shortcode

The JS Support Ticket shortcode allows the display of a main ticket on your webpage. It accepts parameters for modifying its output, ensuring flexibility. This shortcode initiates the ‘show_main_ticket’ function, which sanitizes the arguments passed to it. It then adds these arguments to the global ‘jssupportticket’ data array. The shortcode also retrieves the ID of the current page and stores it using the ‘setPageID’ function. After this, it includes a specific slug and appends any cleaned-up output to the content before returning it.

Shortcode: [jssupportticket]

Parameters

Here is a list of all possible jssupportticket shortcode parameters and attributes:

  • jstmod – The module to display in the support ticket system
  • jstlay – The layout style for the chosen module

Examples and Usage

Basic example – A simple usage of the ‘jssupportticket’ shortcode without any parameters. This will display the main support ticket interface.

[jssupportticket /]

Advanced examples – In these examples, we’ll be using the ‘jstmod’ and ‘jstlay’ parameters. The ‘jstmod’ parameter is used to specify the module, and the ‘jstlay’ parameter is used to specify the layout.

Here, we’re using the ‘jssupportticket’ shortcode to display the ‘tickets’ module with the ‘list’ layout.

[jssupportticket jstmod="tickets" jstlay="list" /]

In this example, we’re using the ‘jssupportticket’ shortcode to display the ‘faq’ module with the ‘grid’ layout.

[jssupportticket jstmod="faq" jstlay="grid" /]

Remember, these are just a few examples. You can use any module and layout combination as per your needs.

PHP Function Code

In case you have difficulties debugging what causing issues with [jssupportticket] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('jssupportticket', array($this, 'show_main_ticket'));

Shortcode PHP function:

function show_main_ticket($raw_args, $content = null) {
        //default set of parameters for the front end shortcodes
        ob_start();
        $defaults = array(
            'jstmod' => '',
            'jstlay' => '',
        );
        $sanitized_args = shortcode_atts($defaults, $raw_args);
        if(isset(jssupportticket::$_data['sanitized_args']) && !empty(jssupportticket::$_data['sanitized_args'])){
            jssupportticket::$_data['sanitized_args'] += $sanitized_args;
        }else{
            jssupportticket::$_data['sanitized_args'] = $sanitized_args;
        }
        $pageid = get_the_ID();
        jssupportticket::setPageID($pageid);
        JSSTincluder::include_slug('');
        $content .= ob_get_clean();
        return $content;
    }

Code file location:

js-support-ticket/js-support-ticket/includes/shortcodes.php

JS Support Ticket [jssupportticket_addticket] Shortcode

The ‘jssupportticket_addticket’ shortcode is used to display a form for adding or editing support tickets. It checks user permissions, ensuring only authorized users can add or edit tickets. This shortcode integrates with the JS Support Ticket system, allowing for seamless ticket management. It includes default parameters for job type, city, and company, which can be customized.

Shortcode: [jssupportticket_addticket]

Parameters

Here is a list of all possible jssupportticket_addticket shortcode parameters and attributes:

  • job_type – Specifies the type of job in the ticket form
  • city – Defines the city related to the ticket
  • company – Indicates the company associated with the ticket
  • jstmod – Determines the module of the support system
  • jstlay – Sets the layout of the ticket form, either ‘addticket’ or ‘staffaddticket’
  • jssupportticketid – Unique identifier for the support ticket

Examples and Usage

Basic example – A simple shortcode to display the ticket form.

[jssupportticket_addticket]

Advanced examples

Display the ticket form with a predefined job type, city, and company. The form will use these as default values.

[jssupportticket_addticket job_type="Full Time" city="New York" company="Acme Inc."]

Display the ticket form with a specific job type only. The form will use this as the default job type.

[jssupportticket_addticket job_type="Part Time"]

Display the ticket form with a predefined city and company. The form will use these as default values.

[jssupportticket_addticket city="Los Angeles" company="Tech Corp."]

PHP Function Code

In case you have difficulties debugging what causing issues with [jssupportticket_addticket] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('jssupportticket_addticket', array($this, 'show_form_ticket'));

Shortcode PHP function:

function show_form_ticket($raw_args, $content = null) {
        //default set of parameters for the front end shortcodes
        ob_start();
        $pageid = get_the_ID();
        jssupportticket::setPageID($pageid);
        $module = JSSTRequest::getVar('jstmod', '', 'ticket');
        $layout = JSSTRequest::getVar('jstlay', '', 'addticket');
        if ($layout != 'addticket' && $layout != 'staffaddticket') {
            JSSTincluder::include_file($module);
        } else {
            $defaults = array(
                'job_type' => '',
                'city' => '',
                'company' => '',
            );
            $sanitized_args = shortcode_atts($defaults, $raw_args);
            if(isset(jssupportticket::$_data['sanitized_args']) && !empty(jssupportticket::$_data['sanitized_args'])){
                jssupportticket::$_data['sanitized_args'] += $sanitized_args;
            }else{
                jssupportticket::$_data['sanitized_args'] = $sanitized_args;
            }
            jssupportticket::$_data['short_code_header'] = 'addticket';
            if ( in_array('agent',jssupportticket::$_active_addons) && JSSTincluder::getJSModel('agent')->isUserStaff()) {
                $id = JSSTrequest::getVar('jssupportticketid');
                $per_task = ($id == null) ? 'Add Ticket' : 'Edit Ticket';
                jssupportticket::$_data['permission_granted'] = JSSTincluder::getJSModel('userpermissions')->checkPermissionGrantedForTask($per_task);
                if (jssupportticket::$_data['permission_granted']) {
                    JSSTincluder::getJSModel('ticket')->getTicketsForForm($id);
                }
                JSSTincluder::include_file('staffaddticket', 'agent');
            } else {
                JSSTincluder::getJSModel('ticket')->getTicketsForForm(null);
                JSSTincluder::include_file('addticket', 'ticket');
            }
        }
        $content .= ob_get_clean();
        return $content;
    }

Code file location:

js-support-ticket/js-support-ticket/includes/shortcodes.php

JS Support Ticket [jssupportticket_addticket_multiform] Shortcode

The JS Support Ticket Add Ticket Multiform shortcode allows users to create or edit support tickets. It checks user permissions and, if granted, displays the appropriate form. . This shortcode also includes default parameters for job type, city, and company. It enables agents to add or edit tickets, ensuring the smooth operation of the support system.

Shortcode: [jssupportticket_addticket_multiform]

Parameters

Here is a list of all possible jssupportticket_addticket_multiform shortcode parameters and attributes:

  • formid – The unique identifier of the form
  • jstmod – Defines the module, default is ‘ticket’
  • jstlay – Determines the layout, default is ‘addticket’
  • job_type – Specifies the type of job
  • city – Indicates the city
  • company – Defines the company name
  • jssupportticketid – Unique identifier for a specific support ticket

Examples and Usage

Basic example – Show the form for adding a ticket using the form ID.

[jssupportticket_addticket_multiform formid=1 /]

Advanced examples

Adding a ticket form with a predefined job type, city, and company. The form will automatically fill these fields with the provided values, making it easier for the user to submit the ticket.

[jssupportticket_addticket_multiform formid=1 job_type='Developer' city='New York' company='XYZ Co.' /]

Adding a ticket form for a specific staff member. If the user is a staff member, the form will change to a staff add ticket form. This is useful if you want to allow staff members to create tickets on behalf of the users.

[jssupportticket_addticket_multiform formid=1 jstmod='agent' jstlay='staffaddticket' /]

PHP Function Code

In case you have difficulties debugging what causing issues with [jssupportticket_addticket_multiform] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('jssupportticket_addticket_multiform', array($this, 'show_form_ticket_for_multiform'));

Shortcode PHP function:

function show_form_ticket_for_multiform($raw_args, $content = null) {
        $formid = $raw_args['formid'];
        //default set of parameters for the front end shortcodes
        ob_start();
        $pageid = get_the_ID();
        jssupportticket::setPageID($pageid);
        $module = JSSTRequest::getVar('jstmod', '', 'ticket');
        $layout = JSSTRequest::getVar('jstlay', '', 'addticket');
        if ($layout != 'addticket' && $layout != 'staffaddticket') {
            JSSTincluder::include_file($module);
        } else {
            $defaults = array(
                'job_type' => '',
                'city' => '',
                'company' => '',
            );
            $sanitized_args = shortcode_atts($defaults, $raw_args);
            if(isset(jssupportticket::$_data['sanitized_args']) && !empty(jssupportticket::$_data['sanitized_args'])){
                jssupportticket::$_data['sanitized_args'] += $sanitized_args;
            }else{
                jssupportticket::$_data['sanitized_args'] = $sanitized_args;
            }
            jssupportticket::$_data['short_code_header'] = 'addticket';
            if ( in_array('agent',jssupportticket::$_active_addons) && JSSTincluder::getJSModel('agent')->isUserStaff()) {
                $id = JSSTrequest::getVar('jssupportticketid');
                $per_task = ($id == null) ? 'Add Ticket' : 'Edit Ticket';
                jssupportticket::$_data['permission_granted'] = JSSTincluder::getJSModel('userpermissions')->checkPermissionGrantedForTask($per_task);
                if (jssupportticket::$_data['permission_granted']) {
                    JSSTincluder::getJSModel('ticket')->getTicketsForForm($id, $formid);
                }
                JSSTincluder::include_file('staffaddticket', 'agent');
            } else {
                JSSTincluder::getJSModel('ticket')->getTicketsForForm(null, $formid);
                JSSTincluder::include_file('addticket', 'ticket');
            }
        }
        $content .= ob_get_clean();
        return $content;
    }

Code file location:

js-support-ticket/js-support-ticket/includes/shortcodes.php

JS Support Ticket [jssupportticket_mytickets] Shortcode

The JS Support Ticket shortcode is a compact code that displays a user’s tickets on the front end. It fetches the ticket data based on user roles, whether they are staff or a regular user. This shortcode calls the function ‘show_my_ticket’ which fetches and displays tickets. If the user is an agent, it fetches staff tickets; otherwise, it fetches regular user tickets.

Shortcode: [jssupportticket_mytickets]

Parameters

Here is a list of all possible jssupportticket_mytickets shortcode parameters and attributes:

  • list – The list from which the tickets are fetched
  • ticketid – Specific identifier for an individual ticket

Examples and Usage

Basic example – Displaying user’s tickets on a page.

[jssupportticket_mytickets /]

Advanced examples

Displaying a specific ticket from the user’s tickets using the ‘ticketid’ parameter.

[jssupportticket_mytickets ticketid="123" /]

Displaying a list of tickets based on the specified ‘list’ parameter. This parameter can be used to filter the tickets that are displayed based on their status or other criteria.

[jssupportticket_mytickets list="open" /]

Combining both ‘ticketid’ and ‘list’ parameters to display a specific ticket from a list of tickets that meet the specified criteria.

[jssupportticket_mytickets list="open" ticketid="123" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [jssupportticket_mytickets] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('jssupportticket_mytickets', array($this, 'show_my_ticket'));

Shortcode PHP function:

function show_my_ticket($raw_args, $content = null) {
        //default set of parameters for the front end shortcodes
        ob_start();
        $pageid = get_the_ID();
        jssupportticket::setPageID($pageid);
        $module = JSSTRequest::getVar('jstmod', '', 'ticket');
        $layout = JSSTRequest::getVar('jstlay', '', 'myticket');
        if ($layout != 'myticket' && $layout != 'staffmyticket') {
            JSSTincluder::include_file($module);
        } else {
            $defaults = array(
                'list' => '',
                'ticketid' => '',
            );
            $list = JSSTrequest::getVar('list', 'get', null);
            $ticketid = JSSTrequest::getVar('ticketid', null, null);
            $args = shortcode_atts($defaults, $raw_args);
            if(isset(jssupportticket::$_data['sanitized_args']) && !empty(jssupportticket::$_data['sanitized_args'])){
                jssupportticket::$_data['sanitized_args'] += $args;
            }else{
                jssupportticket::$_data['sanitized_args'] = $args;
            }
            if ($list == null)
                $list = $args['list'];
            if ($ticketid == null)
                $ticketid = $args['ticketid'];
            jssupportticket::$_data['short_code_header'] = 'myticket';
            if ( in_array('agent',jssupportticket::$_active_addons) && JSSTincluder::getJSModel('agent')->isUserStaff()) {
                JSSTincluder::getJSModel('ticket')->getStaffTickets();
                JSSTincluder::include_file('staffmyticket', 'agent');
            } else {
                JSSTincluder::getJSModel('ticket')->getMyTickets($list, $ticketid);
                JSSTincluder::include_file('myticket', 'ticket');
            }
        }
        $content .= ob_get_clean();
        return $content;
    }

Code file location:

js-support-ticket/js-support-ticket/includes/shortcodes.php

Conclusion

Now that you’ve learned how to embed the Js Support Ticket Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *