Ticket Submit form fields on (Support System Plugin)

Hello,

I have installed the support system plugin on my website, on the ticket submission form instead of the current one i need to add the following fields:

Date:
Question:
Description:
Field of study:
Are you a student: (yes or no)

Submit button
---------------

I am really a beginner if it doesn't take much time and is possible for you to make it happen, please make a file so i will paste on my website.

  • Dimitris

    Hey there Saleh,

    hope you're doing good and thanks for reaching us!

    Unfortunately there isn't any out-of-the-box solution for this request as it should require some extended custom development which surpass the scope of this support forum.

    I spotted couple of old threads though on this that may become handy.
    https://premium.wpmudev.org/forums/topic/customization-of-support-system-form#post-819771
    https://premium.wpmudev.org/forums/topic/add-custom-fields-to-the-support-system-support-ticket-form#post-1115830

    For some custom development you may use our Jobs & Pros section. Please keep in mind that no WPMUDEV staff members are included there.

    Warm regards,
    Dimitris :slight_smile:

  • Adam Czajczyk

    Hello Saleh!

    Let me try to guide you "step-by-step" through the solution provided by Ignacio (who's a lead developer of the plugin) in this post:

    https://premium.wpmudev.org/forums/topic/add-custom-fields-to-the-support-system-support-ticket-form#post-1115830

    1. Download the .zip file that I attached to this post and extract it to your local drive

    2. There are two files inside so use FTP client to upload the "support-system-custom-ticket-fields.php" file to the "/wp-content/mu-plugins" folder on your server;

    If there's no "mu-plugins" folder inside the "wp-content" create it first.

    3. Use the "clean text" editor (such as e.g. Notepad++, Sublime or similar) to edit the "class-my-form-submit-ticket-form-shortcode.php" file

    4. Find this code there:

    <!-- INSERT YOUR FIELDS HERE. EXAMPLE:-->
    
    <input type="text" name="my-field" value="">

    This line

    <input type="text" name="my-field" value="">

    is your custom field. You can change it's name attribute value but make sure that it's HTML valid (no special chars, spaces etc).

    If you want to add more field add them directly below that line so it would look like this:

    <input type="text" name="my-field" value="">
    <input type="text" name="my-other-field" value="">
    <input type="text" name="yet-another-field" value="">

    5. Find this code:

    // VALIDATE YOUR FIELDS HERE
    $my_field = sanitize_text_field( $_POST['my-field'] );
    if ( empty( $my_field ) ) {
        wp_die( 'My field cannot be empty' );
    }

    and make it match your fields that you added in step 4. An example code for three fields I added in step 4 would be:

    // VALIDATE YOUR FIELDS HERE
    $my_field = sanitize_text_field( $_POST['my-field'] );
    if ( empty( $my_field ) ) {
        wp_die( 'My field cannot be empty' );
    }
    $my__other_field = sanitize_text_field( $_POST['my-other-field'] );
    if ( empty( $my_other_field ) ) {
        wp_die( 'My other field cannot be empty' );
    }
    $my_field = sanitize_text_field( $_POST['yet-another-field'] );
    if ( empty( $yet-another-field ) ) {
        wp_die( 'Yet another field cannot be empty' );
    }

    6. Find this code:

    // Not an error, let's save My Field as meta
    incsub_support_update_ticket_meta( $ticket_id, 'my-field', $my_field );

    and make it much your fields. Four our three example fields it would be:

    // Not an error, let's save My Field as meta
    incsub_support_update_ticket_meta( $ticket_id, 'my-field', $my_field );
    incsub_support_update_ticket_meta( $ticket_id, 'my-other-field', $my_other_field );
    incsub_support_update_ticket_meta( $ticket_id, 'yet-another-field', $yet_another_field );

    7. Save the file

    8. Use your FTP client and go to the "/wp-content/mu-plugins" folder on your server again
    9. Create "includes" folder inside there
    10. Upload the "class-my-form-submit-ticket-form-shortcode.php" file (that you just saved in step 7) to the "/wp-content/mu-plugins/includes" folder on your server.

    If you didn't skip any step or made any mistake that should be it. It should work for you. Please note though that this adds new fields and doesn't remove existing. It also affects only the front-end support ticket submission page.

    I hope that helps.

    Best regards,
    Adam

  • Saleh

    I have followed the same guidline step by step, at the end i got a fatal error, then i deleted the saved files and re uploaded your files at the directory mentioned i got the same error, but it seems there is a problem on the file that you attached with your previous post.

    will you do me a favor to check the attached file?

    Error: Fatal error: Class 'Incsub_Support_Shortcode' not found in /home/helpinhomework/public_html/tmp/wp-content/mu-plugins/class-my-form-submit-ticket-form-shortcode.php on line 3

  • Adam Czajczyk

    Hello Saleh!

    The error suggests that the "Incsub_Support_Shortcode" class, which is a native/core Support System class, cannot be found and this would suggest that either the Support System plugin is not active or the site or not installed.

    I'm sorry for that kind of question but are you 100% sure that

    1. files are located in right folders:

    support-system-custom-ticket-fields.php in "/wp-content/mu-plugins" folder
    class-my-form-submit-ticket-form-shortcode.php in "/wp-content/mu-plugins/includes" folder

    2. the "Support System" plugin is installed and enabled on that WordPress installation?

    I realize that these are basic questions but I'd like to be 100% sure about that before starting further investigation. I hope that makes sense :slight_smile:

    Let me know please,

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.