WordPress.org

Ready to get started?Download WordPress

Forums

Flexo Archives
[resolved] default sql query filters (7 posts)

  1. christian_feldbauer
    Member
    Posted 3 years ago #

    Hi Heath,
    Great plugin, nice work. There are some issues though. I discovered that you don't allow any sql query filters ('getarchives_where' and 'getarchives_join') which may break other plugins (in my case it is WPML for multi-lingual support).

    Maybe you could add those filters in an upcoming release.

    Cheers,
    Christian

    http://wordpress.org/extend/plugins/flexo-archives-widget/

  2. Heath Harrelson
    Member
    Plugin Author

    Posted 3 years ago #

    To save me from rummaging around in the source code for hours, can you explain why exactly I need to support these things and how not supporting them might break other plugins? I don't understand how my code could get called from anywhere else within WordPress.

  3. christian_feldbauer
    Member
    Posted 3 years ago #

    Hi Heath,
    Most plugins rely on WordPress' action hooks and filters in order to extend its features. The default archive widget uses those filters I have mentioned above (it calls 'apply_filters('filter_name',...)'). As an example, the multi-lingual plugin 'WPML' needs those to get posts only of the active language (and not all languages) by joining its own SQL table for the db query.

    >> ...why exactly I need to support these things...?

    You don't need to. Since you share your code I assume you'd like other people to use it. By writing it in a way to play along with other plugins, more people may use it. I find your plugin great.

    cheers,
    Christian

  4. Heath Harrelson
    Member
    Plugin Author

    Posted 3 years ago #

    I wasn't trying to be rude above. I want people to be able to use my software, but I only have limited time and knowledge. If you could give me a concrete example of how my plugin interferes with WPML, I would be happy to fix it.

  5. christian_feldbauer
    Member
    Posted 3 years ago #

    sure. try to build your query string similar as in the default widget (see wp-includes/general-template.php, function wp_get_archives() ).

    use extra $join and $where variables and use
    $join = apply_filters('getarchives_join',...) and
    $where = apply_filters('getarchives_where', ...) to build them.
    Then concatenate them properly before making the sql request.
    In this way also other plugins can hook in should be able to play along.
    Does this help you?

    cheers,
    Christian

  6. Heath Harrelson
    Member
    Plugin Author

    Posted 3 years ago #

    I see now. I'll work up a fix tonight and include it in the next release.

    Thanks for your help.

  7. Heath Harrelson
    Member
    Plugin Author

    Posted 3 years ago #

    I have added these filters in version 2.1.0.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic