Add date field to Support System Ticket Submit form

Hello,

I have Support System plugin on my website,
I need to add date field to the Ticket submit form, how to add this?

I have searched a lot but couldn't find information about how to add it. Please guide me to do it.

  • Nastia
    • Support Rock Star

    Hello Saleh , I hope you are doing well today!

    Unfortunately, there are no built-in options to customize withing the plugin's settings. The only way is to hard-coding the custom field inside the plugin files.

    I've found some thread that includes some tips how to add a custom field inside the plugin:
    https://premium.wpmudev.org/forums/topic/add-custom-fields-to-the-support-system-support-ticket-form#post-1115830

    I've asked for a developer;s feedback here. Once I have an update, I will post it right here.

    Kind regards,
    Nastia

  • Ignacio
    • HummingBird

    Hi Saleh

    Sorry for the delay. There are two steps to add a new date file to the form:
    1. Add the date field and process it
    2. Get that date field and show it into the ticket edit screen (in wp-admin)

    In order to add the date field you need to grab the current ticket form class and replace it for another class of yours. First, tell Support System that you're going to replace that class:

    // Yeah, there's a typo in that filter
    add_filter( 'support_system_shortccodes', 'saleh_replace_ticket_form_shortcode' );
    function saleh_replace_ticket_form_shortcode( $shortcodes ) {
    	//  Place the file wherever you want
    	include_once( 'includes/saleh-shortcode.php' );
    
    	// this will make Support System to use My_Form_Submit_Ticket_Form_Shortcode class for the shortcode
    	// instead of the current one
    	$shortcodes['support-system-submit-ticket-form'] = 'Saleh_Submit_Ticket_Form_Shortcode';
    	return $shortcodes;
    };

    And here's the code in includes/saleh-shortcode.php:
    https://gist.github.com/igmoweb/33761d5470a2690c9074b9709fc5a4d6

    See that I added the new field but also processed it in process_form() function by using incsub_support_update_ticket_meta() function

    Now you need to show that field in wp-admin:

    /**
     * Show the date in admin
     */
    add_filter( 'support_network_ticket_update_fields', 'saleh_show_ticket_date', 10, 2 );
    function saleh_show_ticket_date( $fields, $ticket ) {
    	$fields['my-date'] = array(
    		'label' => 'My Date',
    		'content' => incsub_support_get_ticket_meta( $ticket->ticket_id, 'my-date', true )
    	);
    	return $fields;
    }

    Now you should see the date value when editing a ticket in wp-admin

    Regards.
    Ignacio.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.