WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
Issues with Polylang 1.2.x (38 posts)

  1. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    Some users are having issues with Polylang 1.2.x as for example it breaks the Avada theme. Since the database has been modified between 1.1.6 and 1.2, it is not as easy as usual to revert to the previous version.

    For people who have not made a database backup before the upgrade and who need to revert to 1.1.6, a plugin is available on pastebin: http://pastebin.com/0TdQzQLv

    Please follow carefully the instructions and do not orget the database backup.

    You can ask questions on this procedure on this thread. Please open a separate thread for Polylang 1.2.x bug reports.

    http://wordpress.org/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    Known issue: After upgrading to 1.2.1, you may have to re-affect your menus to menus locations. I will try find a fix in the coming hours.

  3. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    The nav menus locations upgrade should now be fixed for all users upgrading to 1.2.1 from now.

    There will be no fix for users who have upgraded before. They still have to re-affect menus to menus locations manually.

    For users who do need to downgrade to 1.1.6, the nav menus locations are also lost during the downgrade process so they also have to re-affect nav menus locations manually.

  4. danielgc
    Member
    Posted 8 months ago #

    I downloaded the latest version and I'm having that problem, but only with one menu. I've tried creating a new menu, resetting the position and so on, but it still has the problem, it only shows the footer menu in spanish :(

    http://www.digaygane.com/newsite (" Aviso de Privacidad / Términos de Uso ")

    Could you help me plz?

  5. danielgc
    Member
    Posted 8 months ago #

    It was very strange that only the footer menu didn't work. I opted for hardcode it using if (pll_current_language()=='en') and so on... thx anyway.

  6. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    The problem I reported here with menus is for example this:
    In 1.1.6, you have two menus at two menus locations
    Primary English -> menu_en
    Primary Espanol -> menu_es

    After the upgrade, you got
    Primary English -> menu_en
    Primary Espanol -> nothing

    It was possible of course to manually re-affect menu_es to Primary Espanol in Appearance->menus after the upgrade. But I corrected Polylang so that this manual operation after upgrade is not necessary anymore.

    This for sure is for themes registering their nav menus and using wp_nav_menu to display them.

    If you are obliged to hardcode something in the theme, then that's another issue.

  7. dFactory
    Member
    Posted 8 months ago #

    Chouby, we've notced an issue with Ajax calls. Before 1.2 we were adding lang=xx parameters, now it stopped working.

    Debug info:

    Notice: Undefined variable: model in C:\SERWER\htdocs\[...]\plugins\polylang\frontend\choose-lang.php on line 30

    Fatal error: Call to a member function get_language() on a non-object in C:\SERWER\htdocs\[...]\plugins\polylang\frontend\choose-lang.php on line 30

  8. miguelcortereal
    Member
    Posted 8 months ago #

    @Chouby

    This plugin is a complex one, no doubt about how complicated it is.

    Current version isn't reading one <admin-texts> entry I have at one of wpml.xml files as beta version was, so strings table lack of that entry.

    Is it possible that current version is missing one fix you did to beta version code that improved wpml compatibility ?

  9. miguelcortereal
    Member
    Posted 8 months ago #

    UPDATE:

    Maintain the plugin complexity and forget about my issue with that <admin-texts> entry.

    I had an error on that file, so it was my fault.

  10. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    @dFactory
    Changing this line 30 from:

    $this->set_language(empty($_REQUEST['lang']) ? $this->get_preferred_language() : $model->get_language($_REQUEST['lang']));

    to

    $this->set_language(empty($_REQUEST['lang']) ? $this->get_preferred_language() : $this->model->get_language($_REQUEST['lang']));

    should solve the fatal error issue.

    Could you tell me if everything with your ajax call is OK after this change.

    @miguelcortereal
    Yes this plugin is growing complex... The first version for my own usage was still quite simple. But covering more aspects of WordPress and adding new features made it complex.

    Is it possible that current version is missing one fix you did to beta version code that improved wpml compatibility ?

    hopefully not.

  11. dFactory
    Member
    Posted 8 months ago #

    @Chouby,
    It fixes the fatal error, but started to throw a bunch of notices (first Ajax call is ok, second and every other throws notices):

    Notice: Trying to get property of non-object in C:\SERWER\htdocs\df\wp\wp-content\plugins\polylang\frontend\choose-lang.php on line 54
    
    Notice: Trying to get property of non-object in C:\SERWER\htdocs\df\wp\wp-content\plugins\polylang\frontend\choose-lang.php on line 55
    
    Notice: Trying to get property of non-object in C:\SERWER\htdocs\df\wp\wp-content\plugins\polylang\frontend\choose-lang.php on line 57
    
    Notice: Trying to get property of non-object in C:\SERWER\htdocs\df\wp\wp-content\plugins\polylang\frontend\choose-lang.php on line 58
    
    Notice: Trying to get property of non-object in C:\SERWER\htdocs\df\wp\wp-content\plugins\polylang\frontend\frontend-filters.php on line 79
  12. danielgc
    Member
    Posted 8 months ago #

    I indeed registered the nav menus and used wp_nav_menu to display them, and as a matter of fact it worked on 2 of 3 menus, except the one in the footer. I tried deactivating and reactivating the plugin, creating new wp menus, and nothing worked, so I gave up and hardcoded them (I know, I shouldn't do that) but I don't have more time to debug it. I'm letting people know here just in case they have problems with using more than 2 menu locations.

    Best regards and thx for your patience and time in developing such a useful plugin!

  13. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    @dfactory
    I don't understand these notices as they mean that the line 30 did not pass a language object. All my tests (with or without 'lang' passed in the ajax request) work correctly. Could it be a wrong copy paste? I just uploaded a new development version (1.2.1.1) Could you test with it?
    http://downloads.wordpress.org/plugin/polylang.zip

    Or is it possible for me to test your plugin?

  14. dFactory
    Member
    Posted 8 months ago #

    It didn't make the difference.

    Take a look at our News Manager (http://wordpress.org/plugins/news-manager/) or Events Maker (http://wordpress.org/plugins/events-maker/). Both have an Ajax Calenadar that worked before the recent update of Polylang.

  15. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    I will test them

  16. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    Thanks ! I believe I would not have found the problem without testing your plugins. The problem came from the fact that ICL_LANGAGE_CODE (that you are using to force the language in your ajax requests) was incorrectly defined when doing ajax on frontend. Since 1.2, Polylang defines this constant on admin side (based on the admin language filters state) as WPML does.

    I uploaded a new development version (1.2.1.4) to include the fix.
    http://downloads.wordpress.org/plugin/polylang.zip

  17. dFactory
    Member
    Posted 8 months ago #

    Happy to hear that @Chouby. We'll test that also.

  18. wordpressdennis
    Member
    Posted 7 months ago #

    hi,

    i have an "Notice: Trying to get property of non-object" error when saving/publishing a post.

    this line is the problem:
    [code]public function get_translation(...) {
    $slug = $this->get_language($lang)->slug;
    ....
    }[/code]

    it throws an error with a custom post type i use to add field sets to other (custom) post types with the plugin "Advanced Custom Fields".

    is it possible to add a fallback? for me that works for the moment, but for sure its not a nice solution:
    [code]if(empty($this->get_language($lang)->slug)) {
    $slug = 'de';
    } else {
    $slug = $this->get_language($lang)->slug;
    }[/code]

  19. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

    Thanks for reporting this. I could reproduce and debug it. This is the result of some conflict between the WPML compatibility mode of both ACF and Polylang. I will fix this in the next release.

  20. hansbaer
    Member
    Posted 7 months ago #

    I get an error message with the latest (1.2.3) version on WP 2.7.1 with the Atahualpa theme:

    Warning: Invalid argument supplied for foreach() in [...]/wp-content/plugins/polylang/frontend/frontend-nav-menu.php on line 144

    $menus in the function at that position is no array apparently but is treated as one. I have made a quick fix by making an

    if(is_array($menus)) {
    // foreach code goes here
    }

    around it, but that's not more than a dirty hack.

  21. Matt Gibson
    Member
    Posted 7 months ago #

    Yup, I'm getting the same thing with with the stock Twenty Ten theme, just seems to be some missing braces:

    public function nav_menu_locations($menus) {
    		if (is_array($menus))
    			$theme = get_option('stylesheet');
    
    			foreach ($menus as $loc => $menu) {
    				if (!empty($this->options['nav_menus'][$theme][$loc][$this->curlang->slug]))
    					$menus[$loc] = $this->options['nav_menus'][$theme][$loc][$this->curlang->slug];
    			}
    
    		return $menus;
    	}

    ...the indentation suggests that there should be braces with the is_array() conditional so that the foreach is inside it to me?

  22. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

    Yes that's this... That's not a dirty hack as it is the only way to fix if you don't use custom nav menus.

    I included the fix (with some others) in the development version (1.2.3.2).
    http://downloads.wordpress.org/plugin/polylang.zip

  23. Matt Gibson
    Member
    Posted 7 months ago #

    Cool, thanks for the confirmation. Confused the hell out of me before I spotted the missing brackets ("But it's *uninitialised*! How can it be an array?!") :D

  24. gabyu
    Member
    Posted 7 months ago #

    I have encountered an issue during the upgrade from 1.1.6. My custom menus remain in the default language (French) even I have custom menu set for every language (Fr, En and Chinese). It's obviously a theme issue as when I'm switching back to Twenty Twelve, the problem is fixed.

    Here is how I am register my menus in functions.php

    function register_my_menus() {
    	  register_nav_menus(
    	    array(
    	      'header-menu' => __( 'Header Menu' ),
    	    )
    	  );
    	}
    	add_action( 'init', 'register_my_menus' );

    and in my template (ie. page.php):

    <nav id="nav" role="navigation">
     			<?php wp_nav_menu( array('header-menu' => 'Header Menu') ); ?>
     </nav>

    Plugins in use:
    jQuery Smooth Scroll
    kt-cleanpress
    Quick Page/Post Redirect Plugin

    My question: what's the new, optimal recommended markup to display the menu when we use Polylang ?

    Thank you.

  25. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

    The wp_nav_menu call is wrong. Here is the correct code

    <nav id="nav" role="navigation">
    <?php wp_nav_menu( array('theme_location' => 'header-menu') ); ?>
    </nav>

    See wp_nav_menu usage: http://codex.wordpress.org/Function_Reference/wp_nav_menu
    I really can't imagine how it could work with Polylang 1.1.6!

    Note: The problem is that this buggy code can work without Polylang. Because if you don't provide the theme_location argument, WordPress fallbacks to the first registered location. And if there is one unique location, you don't notice the code is buggy :( But with Polylang the location is no more unique... This is one of the most common mistake I find in themes.

  26. hansbaer
    Member
    Posted 7 months ago #

    Thanks for the quick reply. I am happy to see that this is one of the rare occasions that the simplest fix without any deeper understanding of the whole architecture turned out to be an actual solution :-)

    Thanks and keep up the good work! Polylang is a great plugin!

  27. gabyu
    Member
    Posted 7 months ago #

    Thank you for the quick reply. I have made the change and it worked.

  28. huppellepup
    Member
    Posted 7 months ago #

    I had the warning problem [...]/frontend-nav-menu.php on line 144 to

    The 1.2.3.2 version solved the problem for me.
    Thank you.

  29. Pahaaco
    Member
    Posted 7 months ago #

    Hello Chouby, I have the same error of huppellepup. Have you got a fix to this problem ?

  30. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

Reply »

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.