• hi, first of all this is a great plugin which was working fine until I decided to turn my site bilingual. for this I am using polylang plugin. When I use both the plugin. I am getting following error.

    FATAL ERROR: CALL TO A MEMBER FUNCTION GET_DEFAULT_LANGUAGE() ON A NON-OBJECT IN /HOME/BHAWNA180115/PUBLIC_HTML/WP-CONTENT/PLUGINS/MULTI-RATING/INCLUDES/CLASS-API.PHP ON LINE 714

    I really want to use multi rating. Please help me with the issue.

    https://www.ads-software.com/plugins/multi-rating/

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

    (@dpowney)

    Hi there,

    Multi Rating fully supports WPML. I’ll be making some updates to use the new WPML hooks and filters which may resolve this issue for Polylang.

    In the meantime, try adding this to your wp-config.php file:
    define(‘PLL_WPML_COMPAT’, false);

    Daniel

    Thread Starter abhisheksuneri

    (@abhisheksuneri)

    hi Daniel,

    the code didn’t work. I am getting the same problem.

    Pilar Mera

    (@decrecementofeliz)

    Hi, I have the same problem as Daniel.

    The wp-config line solves the Multirating error, but also disables some Polylang functionalities (like String Translation of custom post type os custom taxonomies), so I hope you can post the update soon so we can use both plugins normally.

    Thanks!
    Pilar

    Plugin Author dpowney

    (@dpowney)

    There’s a GitHub issue to track this. https://github.com/danielpowney/multi-rating/issues/36. In WPML > 3.2 there’s a new filter which should resolve this issue. This is on my TODO list.

    Daniel

    Pilar Mera

    (@decrecementofeliz)

    Hi Daniel, thanks for answering.

    But I’m afraid I can’t solve this hook thing on my own, and I can’t wait much longer for this problem to be solved (my site is going live soon), so I guess I’ll have to try with another plugin, although I really like yours ??

    Unless you’re planning to update this in the next few days??

    Regards,
    Pilar

    Pilar Mera

    (@decrecementofeliz)

    Hi again.

    I finally got into the code and could make it work, though I’m not sure these tricks are stable enough. Anyway, this is what I did, in case it can help somebody:

    Basically, I converted each instance of icl_object_id function that appears on the plugin with the wpml_object_idfilter, and removed all the conditional statements that were checking if icl_object_id exist.
    So:

    if ( function_exists( 'icl_object_id' ) ) {
    				$rating_result['post_id'] = icl_object_id( $temp_post_id , get_post_type( $temp_post_id ), true, ICL_LANGUAGE_CODE );
    			}

    became:

    $rating_result['post_id'] = apply_filters('wpml_object_id', $temp_post_id, get_post_type( $temp_post_id ), true, ICL_LANGUAGE_CODE );

    Another example:

    if ( function_exists( 'icl_object_id' ) ) {
    				global $sitepress;
    				$post_id = icl_object_id ( $post_id , get_post_type( $post_id ), true, $sitepress->get_default_language() );
    			}

    Became:

    $defaultlanguage = pll_default_language();
    $post_id = apply_filters('wpml_object_id', $post_id, get_post_type( $post_id ), true, $defaultlanguage );

    You just need to replace the parameters of the filter with the parameters of the old function ($post_id or $temp_post_id, etc.)

    The files that need to be changed as they contain these functions are:
    includes/class-rating-form.php
    includes/class-api.php
    includes/admin/tools.php
    includes/admin/class-rating-results-table.php
    includes/admin/class-rating-entry-table.php

    Hope that helps, regards!
    Pilar

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘compitability issue with polylang plugin’ is closed to new replies.