×
Kunena 5.2.6 released and Blue eagle 1.6.6 released (25 Jul 2021)

The Kunena team has announce the arrival of Kunena 5.2.6 [K 5.2.6] which is now available for download as a native Joomla extension for J! 3.9.x. This version addresses most of the issues that were discovered in K 5.2 and issues discovered during the development stages of K 5.2.6

× Topics that are moved into this category are generally considered to be closed. Users may want to add additional information but these topics should not be resurrected in order to discuss new problems or unrelated matters.

Important Finally! An Important hack for Discuss to work on Multi-language Web Sites with Joomfish Translatio!

More
10 years 7 months ago - 10 years 7 months ago #1 by jorge
Hi everybody. I am new here at the forums. However, I had a special need that I know more people is expecting about discuss plugin. I have a web site in both english and spanish language translated with joomfish. However, we needed a way to link discuss plugin between articles and the forums in a way that we could have both english and spanish comments separated and linked to different topics at the kunena forum.

I am not a developer, but I have experience with php and databases, so I tried to solve the need myself. I know there are hundreds of ways to work around on this, but you know.. it works at least for me!

Here are the instructions on how I achieved that. You should do these changes very carefully and have plenty of time if you want to run into this...

NOTE: You should backup your files first (kunenadiscuss.php and kunenadiscuss.xml) and also the database table jos_kunenadiscuss before running the following procedure.

1) First, in my case, I created a category for both spanish and english languages at the kunena forum. So, you need to create whatever categories for whatever languages you will support.

2) Then, I created sub-categories for both languages (spanish and english) based on the structure we needed. Both languages have exactly the same structure. For example, we have...

Main Board Category
- Spanish
- Sub Category A
- Sub Category B, etc..
- English
- Sub Category A
- Sub Category B, etc..

... so you need to create a structure like this for every language you will support. you should try to have exactly the same structure for every language.

3) At the file kunenadiscuss.xml, I copied the line that says

"<param name="category_mapping" type="text" default="" label="PLG_KUNENADISCUSS_CATEGORY_MAPPING" description="PLG_KUNENADISCUSS_CATEGORY_MAPPING_DESC" />"

...and put a new category mapping line for the english language, for example like this...

"<param name="category_mapping_english" type="text" default="" label="PLG_KUNENADISCUSS_CATEGORY_MAPPING_ENGLISH" description="PLG_KUNENADISCUSS_CATEGORY_MAPPING_DESC_ENGLISH" />"

... This change will create an additional Category Mapping field for every language at the discuss plugin. You should add and edit this line for every additional language you need on your web site...What I did is that I included an _ENGLISH suffix for both the label and description values (see above).

4) After finishing Step 3, you should have a separate Category mapping field created at the plugin. You need to enter the values for that language category mapping like this:

JoomlaCategory, KunenaCategory; JoomlaCategory, KunenaCategory; and so on... ex. 139,10;200,20; (<-- check the syntax very carefully as there are ";" between category pairs..

This will create mappings between the Joomla categories and Kunena Forum categories that will be allowed to have comments on their respective articles separately depending on session languages running at the site.

5) The main limitation for the discuss plugin as of today is the database table. This table have only two fields: content_id (for joomla articles id) and thread_id (for kunena threads ids). What I did is that I hacked the table. I added a field called "language" and removed the PRIMARY KEY for contentid. Then, created a new PRIMARY KEY based on both content_id and thread_id. This is because we need the following to occur for multi-language..

content_id thread_id language
139 10 us
139 15 es

...this means that now with this change I could have the same article #139 linked with both the thread number 10 for the english-us (en-US) language and the 15th for the spanish-es (es-Es) language. The translations are managed by joomfish. That's why it is the same article id (139, as in this example) but,

File Attachment:

File Name: discuss-hack.zip
File Size:10 KB

with different kunena threads mappings (see above).

4) A hack included for kunenadiscuss.php is attached. The hacks done to this file permit to have the changes to the database described above (step 5). I have included an if statement that based on the languages you need to support, you should change the following lines (almost at the end of kunenadiscuss.php file):

if ($lang == 'us') {
// Category pairs will be always allowed
$categoryPairs = explode ( ';', $this->params->get ( 'category_mapping_english', '' ) );
$categoryMap = array ();
foreach ( $categoryPairs as $pair ) {
$pair = explode ( ',', $pair );
$key = isset ( $pair [0] ) ? intval ( $pair [0] ) : 0;
$value = isset ( $pair [1] ) ? intval ( $pair [1] ) : 0;
if ($key > 0)
$categoryMap [$key] = $value;
}

...all you need to change at this code is the value at the first line 'us' with your language code or lang variable (fr for french, en for english-GB, etc..). Also, you need to change the 'category_mapping_english' with the mapping names you created above (Step 3) at the param name field. Remember to use "category_mapping_languagename" and change languagename for whatever language you need to support.

I have included the hacked files: kunenadiscuss.php, kunenadiscuss.xml and the database kunenadiscuss.SQL.
Attachments:
Last edit: 10 years 7 months ago by jorge.
The following user(s) said Thank You: tisiman

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.065 seconds