Support » Plugin: More-Lang » Great & Amazing plugin.. but doesn’t work with a KB plugin

  • Resolved AceAutomation.eu

    (@rguilbert)


    Greetings clivezhg !

    I’m testing a KB plugin with your plugin on an old website (rievtech).
    https://rievtech.fr/knowledge-base/
    https://wordpress.org/plugins/echo-knowledge-base/

    Your plugin is very easy to use, light, amazing, simple.. My congratulations ! Sincerly. It’s not the case for WPML!

    The only things which doesn’t work, it’s with the KB page.. it doesn’t switch in the correct language.. it stay on the main language. But link are correct.
    I think it’s not your “fault” and you can do anything.

    You can try to switch en/fr … KB page doesn’t change, but if you click on the article, the correct page is open.

    WPML is very heavy.. I use it for my main website but I would like not use your plugin for our support website (support.aceautomation.eu).

    Thanks a lot for your plugin. I hope the KB plugin will be compatible soon.
    Rémi

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author clivezhg

    (@clivezhg)

    Hi Rémi, thanks a lot for your appreciation.
    Regarding your issue, when I visited the https://rievtech.fr/knowledge-base/, I got “Oops! 404 Not Found…Sorry, an error has occured, Requested page not found!”, it looks like the page is missing now.
    I will test the KB plugin on your WordPress version (4.9.11), and try to figure out what’s the problem.

    Hi Clive. Thanks for your answer.
    I setuped a website for test 3 plugins togheter.
    Your plugin More-Lang
    + Knowledge Base for Documents and FAQs by Echo Plugins
    + DeepL for WordPress : translation plugin by Fluenx. This plugin just tranlsate automaticly the html page in the editor. It doesn’t affect the frontend.
    The most important is your plugin and Knowledge Base plugin.
    I think these 3 plugins togheter can mahe a great, light and userfriendly solution for setup a KB wordpress website.
    I believe a lot to your plugin. And the DeepL plugin is great for translation.
    About the issue between KB and you plugin:
    First I can give you an access to the backend of my test website. Private message – how to ? http://www.test.aceautomation.eu/
    The main KB page doesn’t switch in the correct language. Here, always in english.
    But links are correct, when I select the post, I arrive to the correct language.
    I think it’s not the fault of your plugin.
    But if you can to do somthing, that would be great ! Let me know if you need something. We can help you and paticipate.
    You can try to switch en/fr/de, the KB page doesn’t change, but if you click on the article, the correct page is open.
    Thanks
    Let me knwo for the login/password, how I can send it to you.
    Again, thanks a lot for your great plugin. I love it because it light and UI friendly.
    Rémi

    Plugin Author clivezhg

    (@clivezhg)

    Hi Rémi, I already figured the issue on my local server.
    The cause is that the KB plugin doesn’t follow the normal WordPress way of displaying Post Titles & Category Names, and More-Lang filters are not applied. So, I would say it’s a defect of the KB plugin.
    Anyway, I wrote a simple fix for the KB plugin, you can follow the following steps to add it:
    1. Open the file ~\wp-content\plugins\echo-knowledge-base\includes\features\layouts\class-epkb-layout.php
    2. Find the section:

    		// for WPML filter categories and articles given active language
    		if ( EPKB_Utilities::is_wpml_enabled( $kb_config ) ) {
    			$this->category_seq_data = EPKB_WPML::apply_category_language_filter( $this->category_seq_data );
    			$this->articles_seq_data = EPKB_WPML::apply_article_language_filter( $this->articles_seq_data );
    		}
    

    3. Paste the code below after that section:

    		/* Apply WordPress filters to support More-Lang */
    		if (is_array($this->articles_seq_data)) {
    			foreach ($this->articles_seq_data as &$seq_data) {
    				if (is_array($seq_data)) {
    					foreach ($seq_data as $id=>$data) {
    						if ($id === 0) {
    							$ekpb_term = get_term_by('name', $data, 'epkb_post_type_1_category');
    							if ($ekpb_term) {
    								$seq_data[$id] = apply_filters('list_cats', $data, $ekpb_term);
    							}
    						}
    						else if ($id > 1) {
    							$seq_data[$id] = apply_filters('the_title', $data, $id);
    						}
    					}
    				}
    			}
    		}
    

    And, if you adopt the above fix, note that the change will be cleared after upgrading the KB plugin.
    Thanks for your posting, hope that the above can help you!

    Hi Clive,
    You are so amazing! Too strong 🙂 That works! That seem so simple for you.
    Some words can’t be translated on the main page but that doesn’t matter… and I think that can be solved with your translation settings page.
    But unfortunately the search function doesn’t works for others language…
    As example, with the French KB main page:
    http://www.test.aceautomation.eu/fr_FR/
    – if I enter ” configurer ” as searched word, no results. Despite than this word exist in the french artcicle.
    – If I enter ” passwords “, this word exist in english and french, but the result on the french KB is the post english version.
    But I know, it is a defect of the KB plugin 🙁
    Does they are a way for translate the URL also (same as the post title) ?
    Thanks
    Let me know I would like to help you if need.
    Rémi from France.

    Plugin Author clivezhg

    (@clivezhg)

    Hi Rémi, the URL http://www.test.aceautomation.eu/fr_FR/ doesn’t work, it looks like that the format has been changed to http://www.test.aceautomation.eu/fr/.
    The KB plugin uses its own way for searching, so the More-Lang fields are not included. The following steps can make it support More-Lang:
    1. Open the file ~\wp-content\plugins\echo-knowledge-base\includes\features\kbs\class-epkb-kb-search.php
    2. Find the section:

    		$found_posts_obj = new WP_Query( $search_params );
    		if ( ! empty($found_posts_obj->posts) ) {
    			$result = $found_posts_obj->posts;
    			wp_reset_postdata();
    		}
    

    3. Paste the code below after that section:

    		$flds = ['content', 'title', 'excerpt'];
    		global $ml_registered_mlocales;
    		if (isset($ml_registered_mlocales) && count($ml_registered_mlocales) > 0) {
    			$locales = $ml_registered_mlocales;
    			$pfx = '_post_content_morelang_nml_';
    			$search_params['meta_query'] = array ( 'relation' => 'OR' );
    			foreach ($flds as $fld) {
    				foreach ($locales as $locale) {
    					$search_params['meta_query'][] = array( 'key' => '_post_' . $fld . '_morelang_nml_' . $locale, 'value' => $search_terms, 'compare' => 'LIKE' );
    				}
    			}
    			unset($search_params['s']);
    			$found_posts_obj = new WP_Query( $search_params );
    			if ( ! empty($found_posts_obj->posts) ) {
    				$new_posts = $found_posts_obj->posts;
    				wp_reset_postdata();
    				foreach ($new_posts as $key=>$new_post) {
    					foreach ($result as $post) {
    						if ($new_post->ID === $post->ID) unset($new_posts[$key]);
    					}
    				}
    				$result = array_merge( $result, $new_posts );
    			}
    		}
    

    And even if you follow these steps, the searching results will return the default links, the “but the result on the french KB is the post english version” issue will be still there.
    ___”Does they are a way for translate the URL also”, there’s no way in More-Lang (but it’s the native behavior in the URI-map module of More-Lang Pro).
    Thanks!

    Plugin Author clivezhg

    (@clivezhg)

    Resolved since no further feedback after 10 days.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Great & Amazing plugin.. but doesn’t work with a KB plugin’ is closed to new replies.