WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
Incompatible with WPSQT (3 posts)

  1. Ollie Armstrong
    Member
    Posted 2 years ago #

    Hi, I am the developer of WPSQT and your plugin is not compatible with mine.

    After some looking around your source, I found a way to fix the incompatibility. However, it is not ideal so I am asking for some help for you.

    On line 475 of sfc-base.php it checks if there is a $post->filtered_content field. If in the line above this I set the $post->filtered_content equal to anything, my plugin now works fine.

    So I am looking for a way that from inside my plugin, if I can set a meta value or something similar for a particular page that your plugin will retreive a value for filtered_content. I have tried setting the post_filtered_content and I have tried adding meta keys for this page but nothing seems to work. I cannot find out where I could set this filtered_content value.

    A little help would be fantastic.

    Cheers,
    Ollie Armstrong

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Ollie Armstrong
    Member
    Posted 2 years ago #

    Also, can I suggest that on line 475 and 518, if you use isset() instead of just using the variable name so that it doesn't output a notice if the variable doesn't exist?

  3. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    If you set the filtered_content field to something, then you are essentially disabling that whole part of the plugin and breaking it.

    The filtered_content field is used to hold the content of the post after it has passed through the_content filters. If you're setting this, and thus not running the_content filters, then it's your plugin which is written incorrectly, not mine.

    Basically, you're either using a filter or a shortcode in a way that produces side-effects, which cause a non-repeatable action to occur.

    SFC intentionally processes the content early, in the header. This is because it needs to get the complete HTML of the post to work with. So it calls the_content filter on the post's content. This causes all other plugins and shortcode systems and everything else to run across the post content, and then return it, as text, to the plugin. This is a correct use of filters.

    However, your plugin, in some manner, is doing something more than just filtering the content. You're using a filter (or shortcode) function to take some other action outside the scope of "filtering".

    Filters filter. Actions take action. That's why we have two entirely different things in WordPress for them. Actions and filters are NOT the same thing, and when you take an action from inside a filter function (or a shortcode) you end up with bad results when somebody is calling filters in places you're not expecting them to be called.

    The fix to your code is more complex than adding something which breaks my code. Your code is broken on a more fundamental level, in that you're using a filter function wrong, somehow, somewhere.

    Note that shortcodes are a type of filter. They receive the shortcode and text it contains, and they are expected to return replacement text. They are thus filters, by definition, and should not create any side-effects either.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic