WordPress.org

Support

Support » Plugins and Hacks » Dynamic Widgets » [Resolved] Submenus for multilingual categories (WPML/DynamicWidgets)

[Resolved] Submenus for multilingual categories (WPML/DynamicWidgets)

  • Hi there,

    i am using dynamic widgets to show submenus in each of my categories. The support for WPML works as it should … nearly. I seem to have the same problem as here (http://wordpress.org/support/topic/plugin-dynamic-widgets-dynamic-widgets-wpml-submenus-on-sidebars?replies=11) but i cant find a way to solve it.

    Category-A contains the posts a1, a2, a3 and so on. So when i now say submenu-A should be shown only at the category-A-page an its children, it works fine in the main language. It also works for the children in other languages, but not for the category page itself.

    According to the former thread there seems to be a problem with the connection between the multilingual categories. I translated them and they are perfectly connected (language switcher/auto menus/etc.). The only clue i have is, that the posts each have the exact same slug, but categories can´t so they get additions like “-nl” for dutch or “-fr” for french.

    Any ideas how i could fix this. Here´s the site i´m currently working on
    http://advancis.net/web

    Thanks in advance 🙂

    http://wordpress.org/extend/plugins/dynamic-widgets/

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author Qurl

    @qurl

    The only thing I can tell you is that when it’s connected to eachother it should work. DW is not looking at the slug. Only looking at IDs.

    When DW detects another then the default language, it looks up the connected ID so it can apply the rules for it.

    Hi there,

    we finally managed to find help via the WPML support. Unfortunately we could find the problem but not solve it. It seems the problem refers to a part of your plugin. Could you please check this? Here´s what they told us:

    I wanted to update you on what I have found while torubleshooting the issue.

    In the dynamic-widgets/dynwid_worker.php the plugin author is running a check (line 663 – case ‘category’)

    1
    if ( in_array($id, $act_cat) ) {

    I believe the problem is there.

    The array returns the following IDs: 3, 5, 9, 6, 7, 8, 4

    The category ID for this page:http://advancis.net/web/de/category/produkte/ is 37 and as you can see the php conditional fails to return true. 37 is not found in the array.

    This is something the plugin author needs to correct.

    I will inform our “Themes & Plugins Compatibility” team about it so they can contact the plugin author. If you like it may not be a bad idea to open a support ticket in his forum referencing this forum thread.

    And here´s the link to the other support thread:

    http://wpml.org/forums/topic/submenus-for-multilingual-categories-wpmldynamicwidgets/page/3/

    Thanks so far 🙂

    Plugin Author Qurl

    @qurl

    Is 37 the ID of the category in the default language? If so, then this category should be in the list of categories in DW admin and seems not to be ticked. When 37 is not the category of the default language. Which ID of the default language is connected to it?

    Hi,

    the IDs of our category are as following:

    English (default):

    3/News
    5/Products
    9/Solutions
    6/References
    7/Ressources
    8/Service
    4/Partners

    German:

    35/News
    37/Products
    41/Solutions
    96/References
    39/Ressources
    40/Service
    97/Partners

    Plugin Author Qurl

    @qurl

    I assume ID 37 should be connected to ID 5 then. Because DW does return 5, it probably can’t find the language you’re in and then returns the default back. The current language for WPML is detected using the WPML API function wpml_get_current_language()

    Qurl,

    This is Sarah from WPML. I am the one assisting Paul in his thread over at our forum. He asked me to leave a comment here so I hope this is OK.

    As Paul wrote earlier, the two categories in question
    5/Products (en) – 37/Produkte (de) are connected to each other.
    The default category 5/Products (en) is checked in the DW admin settings.

    As far as I can see DW does indeed detect the correct language on the page in question.

    Adding:
    echo "curlang: <pre>"; print_r($curlang); echo "</pre>";

    below:

    // WPML Plugin support
    	include_once(DW_MODULES . 'wpml_module.php');
    	if ( DW_WPML::detect(FALSE) ) {
    		$curlang = DW_WPML::detectLanguage();
    	}

    Returns correctly “de”.

    To exclude the possibility of a user error or misconfiguration may I ask whether the user needs to configure the plugin in a certain way when WPML is active? I could not find any information in the plugin’s settings screen on this but I wanted to ask just in case I am missing the obvious here.

    Plugin Author Qurl

    @qurl

    Hello Sarah, sure no problem!

    I’m wondering what DW_WPML::getID() returns. It should return 5 there when 37 is connected to 5.

    Qurl,

    Thank you for getting back to me.

    DW_WPML::getID() returns 37.

    I followed the code logic in DW and I feel the problem is (line 642 – dynamic-widgets/dynwid_worker.php)

    $id = get_query_var('cat');

    If I’m not mistaken this will return the term_id however what WPML saves in icl_translations is the term_taxonomy_id not the term_id

    This is causes the function getID() in wpml_module.php to pass the wrong data to wpml_get_content_translation()which returns the wrong trid which in turn causes the function getID() return the wrong result – did I manage to confuse you yet, he, he?

    I can send you some screenshots that illustrate the above if you like (need an email address for this)

    Plugin Author Qurl

    @qurl

    Ok, that explains something. I guess WPML must have had good reasons to use the term_taxonomy_id instead of the term_id. Funny the problem never occured during testing or before with other WPML users.

    This means this is an incompatibility between WPML and DW. I have to look into this to see if I’m able to come up with a solution for that.

    Thank you! Let me know if I can be of any help.

    Also, when you resolve this I would encourage you to get the “Multilingual Ready” certification and get listed here: http://wpml.org/documentation/plugins-compatibility/

    Plugin Author Qurl

    @qurl

    Hello Paul and Sarah,

    I think I’ve found a solution for this matter by converting the term_id to the term_taxonomy_id and back in the getID() method. It’s a bit hard to test myself as all my term_id and term_taxonomy_id pairs are exactly the same in my test environment. Are you interested in testing it out? I haven’t committed the change to SVN. So, please send me an email on info at qurl dot nl or via my contact form and I will send back a modified ./mods/wpml_module.php

    Qurl,

    Did Paul contact you already for this? If not I will because I am interested to test you fix.

    Thank you Jacco. I received your email. As far as I can tell the fix works. I asked Paul to check his site as well and confirm that it works for him.

    I hope he will leave a reply here saying as much soon.

    Thank you again for your support and cooperation. It’s been a real pleasure!

    Like I mentioned in another comment, I would definitely encourage you to get the “Multilingual Ready” certification for DW and get it listed here: http://wpml.org/documentation/plugins-compatibility/

    At first sight it seems to finally be fixed. At second i unfortunately found some new issues regarding

    a) nearly completely missing menus in the usual widget interface inside wordpress
    b) the menus on the category pages now work and are connected as the should, but the pages inside the categories no longer contain the menus they had before

    i´m not at the office today so this is only my first impression. I would do a more detailed check tomorrow morning (german time – from now on about 22 hours). I suggest the fix is causing, so i hope it can be handled easily. Thanks so far.

    Paul

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘[Resolved] Submenus for multilingual categories (WPML/DynamicWidgets)’ is closed to new replies.
Skip to toolbar