Support » Plugin: Polylang » Compatability with ThreeWP Broadcast

  • Resolved edward_plainview

    (@edward_plainview)


    Author of ThreeWP Broadcast – network content sharing plugin.

    A user of mine has requested that I build a compatability plugin between Polylang and Broadcast. My plugin works by copying posts +meta +taxonomies to selected blogs in the network, and then linking the broadcasted posts to the original.

    My user would like the translations (links) to be broadcastable also. Upon broadcasting a fatal error is thrown:

    Using $this when not in object context in polylang/admin/admin-filters-post.php on line 54

    This I’ve managed to fix by referencing the $polylang global, but after fixing that there are several other places that use $this.

    The problem seems to be that you your class methods are being called statically when they shouldn’t.

    Strict standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method PLL_Admin_Filters_Post::parse_query() should not be called statically in wp-includes/plugin.php on line 580

    In order to finish writing the compatability plugin, I need for Polylang to fix those references, else I can’t do any translation finding / saving. Unless you have another way of fixing it?

    https://wordpress.org/plugins/polylang/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    Sorry. I don’t understand how you get this error.

    The method PLL_Admin_Filters_Post::parse_query is not static, but the only reference to this method in Polylang is at line 24

    add_filter('parse_query',array(&$this,'parse_query'));

    and you can check yourself that the reference is not static.

    Could you give more indications to help you?

    In order to fully replicate, I suggest the following steps:

    1. Enable the WP_DEBUG define.
    2. Install ThreeWP Broadcast
    3. Write a post
    4. Select another blog in the network
    5. Publish the post

    Otherwise, here is a screenshot of things going south.

    View post on imgur.com

    Broadcast just wanted a list of attachments (children)…

    Plugin Author Chouby

    (@chouby)

    I setup a multisite install with both ThreeWP Broadcast and Polylang sitewide activated on my localhost.

    I created a post (in default language) on site 1, checked the site 2 in the broadcast metabox and published the post. Got no errors and the post is present on both site 1 and site 2.

    What else should I do to reproduce your problem?

    Go to Broadcast > Admin Settings > Debug

    Enable debug mode (for your IP).

    I did the same as you (fresh install, only PLL and BC installed) and got this as per usual:

    View post on imgur.com

    Plugin Author Chouby

    (@chouby)

    I believe that the problem is coming from your debug mode (not WP_DEBUG since I of course made my initial test with WP_DEBUG set to true).

    So I made two tests:
    1. display $wp_filter[‘parse_query’] just after I set it and just before the filter is called. The first refers to an object, the second to the static class. So obviously some function is modifying $wp_filter directly

    2. keeping your debug mode but prevent the call to your method get_hooks(): everything seems to work as expected again. So something should be wrong in this method (I did not went further, but if you find what is wrong in it, I will be interested to know).

    You’re absolutely right. The fault was mine.

    Donated something for your time.

    Plugin Author Chouby

    (@chouby)

    Thanks 🙂

    I have made Broadcast compatible with Polylang! In the Broadcast premium pack I have an included a Polylang-compatability plugin that keeps translation data when broadcasting posts between blogs.

    Information about Broadcast is here: https://wordpress.org/plugins/threewp-broadcast/

    Plugin Author Chouby

    (@chouby)

    That’s really great news 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Compatability with ThreeWP Broadcast’ is closed to new replies.