"support system" acting crazy if short codes are on same page

hi,
basically the plugin was not allowing me to add categories or faq and the faq on the front end was messed up visually.

after trouble shooting i realised it was when i used the "submit new ticket" and "faq" short codes on the same page. when i did this i also correctly selected the same page for both in admin settings.

so basically is this allowed ?
i.e. can i use two short codes on the same page or does each have to be on separate pages ?

the reason i ask is this ;
two of the most popular ticketing systems, "SmarterTrack" and "Kayako" both employ faq's when a user is submitting a ticket. some even do it dynamically by suggesting faq's or topics based on words the user is typing.
the idea is two fold ;
allow the user to quickly and easily find answers as well as reduce support requests.

if it is allowed however then its either a bug or something wrong with my set up.
"support access" granted if required.

your kind assistance in this would be greatly appreciated.
thanks once again in advance.

  • Ash

    Hello @amused

    I hope you are well today and thanks for asking the question.

    I have used two shortcodes in the same page and selected from admin end, and it worked fine for me. Would you please try default WordPress theme to make sure if it is a theme conflict?

    If it's a theme issue, how's about using a external FAQ plugin for the FAQ part only?
    https://wordpress.org/plugins/duofaq-responsive-flat-simple-faq/
    https://wordpress.org/plugins/spider-faq/

    Please let me know.

    Cheers
    Ash

  • amused

    i knew something smelt fishy, as they say :slight_smile:, so i checked the error logs that wpengine provides and this is what i found (screenshot).
    usually the error logs there are empty so i am thinking this is obviously not normal or safe.
    i cannot read heads nor tails from it.

    can this be an indication of my issues above as the error logs clearly gives reference to the plugin ?

    - i blocked out what i thought is personal

    any kind guidance here would be greatly appreciated.

    kind regards.

  • amused

    this version seems to work perfectly @Ignacio

    another problem i did not realise was that when on the front end of web site no questions were showing up if the drop down was on "select a category".
    now all the questions show up which makes sense and the different questions filter when a category is selected from the drop down which is how it is suppose to work.

    i tried creating categories, i have the faq and new ticket on the same page and i basically tried poking to find a fault and all the issues i was having are gone !

    just one thing i can think about is that if i leave the faq short code on a separate page it shows but without styling and the questions do not show. (screenshot).
    i realise this is not how the plugin is intended as i have to choose a page in admin, but can i suggest a future update to allow faq short codes on numerous pages ? i.e. different faq's pertinent to different sections/pages of the site (sales, technical, affiliates, etc.) would prefer to use your plugin rather than install another.

    is this a specific plugin you provided for my issue or will this also be added/updated for use on other sites through "wpmudev dashboard" ?

    again this works perfectly for me so thanks again and also thanks again @Ashok for your kind assistance and support and for touching base with the developer (Ignacio) for me.

    BLESS !!!

  • Ignacio

    Well, there's a quick solution for this. First, replace the incsub-support/inc/classes/class-query.php for the attached one (unzip it first). Don't worry, changes will remain in the next version.

    Let's say you want to show FAQs of category = 5 in your page ID = 2 and hide the categories selector for that page.

    You can add the following code on your theme functions.php or use a plugin for that (just follow the instructions in the comments):

    <?php
    
    add_action( 'support_system_parse_query', 'amused_hook_support_system_query' );
    function amused_hook_support_system_query( $query ) {
    	$post_id = get_the_ID();
    
    	// Here's where you put the page ID where you want to put another FAQ shortcode
    	$my_page_id = 2;
    
    	if ( $post_id === $my_page_id ) {
    		// Here's where you put the FAQ category you want to display in that page
    		$my_category_id = 5;
    
    		if ( ! isset( $_GET['cat-id'] ) ) {
    
    			wp_redirect( add_query_arg( 'cat-id', $my_category_id ) );
    			exit;
    		}
    		$query = incsub_support()->query;
    		$query->is_support_system = true;
    		$query->is_faqs_page = true;
    		$query->category_id = $my_category_id;
    
    		add_action( 'wp_head', 'amused_hide_support_faq_filtering' );
    	}
    
    }
    
    function amused_hide_support_faq_filtering() {
    
    	// Make sure that .page-id-2 matches $my_page_id of the previous function
    	?>
    	<style>
    			body.page-id-2 .support-system-filter {
    				display: none;
    			}
    	</style>
    	<?php
    
    }

    In order to get the category ID, go to Network>Support>FAQ Categories and click on one of them to edit. You'll see a parameter in the URL that indicates the category ID, like "...&category=5".

    That said, I'm planning changes in the Support System query class. Yet the new changes I attached will remain, this could break in following versions but it will work for the moment.

    Regards.
    Ignacio.