• Hi there.
    First of all thanks for your plugin. It′s awesome!

    I′m trying to create custom log queries on [wordpoints_points_logs] shortcode.

    I need to show a specific user logs (filtering by id), but the current available options I′ve found are ‘default’,’current_user’ and ‘network’.

    Is there any way to achieve this using shortcodes?
    Can I use another function on my code?

    I′ve tried things like:
    [wordpoints_points_logs query=”WHERE user_id=10″ points_type=”user”]
    [wordpoints_points_logs query=”AND user_id=10″ points_type=”user”]

    Thanks in advance!

    https://www.ads-software.com/plugins/wordpoints/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author J.D. Grimes

    (@jdgrimes)

    Hi @hamlet237,

    Thanks for the review, I’m glad you like the plugin!

    The shortcode doesn’t currently support modifying the query in that way. The code is designed to only display predefined queries. Unfortunately, because of this design, the best way for you to achieve what you want right now would be to create your own shortcode.

    However, I think this wold be a very useful feature, so am going to add it to the list of changes to make in the future. I don’t think that I will have time to do it before version 2.1 is released, but if not, I will do it in 2.2.

    If you know PHP and would rather not wait, I can guide you in how to modify the shortcode yourself.

    Thread Starter hamlet237

    (@hamlet237)

    Hi J.D. Grimes.

    I know PHP, so I hope I can help you programming some code in your plugin.
    I′ll be glad if you like it and you add the modifications in the future.

    I have written two big projects:
    https://padresenlanube.com/
    https://fairchanges.com/
    The first one is based on WP.

    And I′ve contributed with some code to the clean login plugin, version 1.6:
    https://www.ads-software.com/plugins/clean-login/changelog/

    So please, guide me, and I′ll try to do my best!

    Plugin Author J.D. Grimes

    (@jdgrimes)

    OK.

    The points logs shortcode currently uses the wordpoints_show_points_logs_query() function. But that function can only display predefined queries. So when we want to customize the query, we’ll need to bypass it and use wordpoints_get_points_logs_query() and wordpoints_show_points_logs() directly instead.

    We could offer the different query vars as shortcode attributes. (We might not need to offer all of the query vars, and some of them might need special processing.) Then we’d use the set_args() method to modify the basic query, which would be retrieved with wordpoints_get_points_logs_query(). Finally, wordpoints_show_points_logs() would be used to display the logs.

    I’m not sure how all of this will play with the query caching, but I don’t think it will break anything. Ideally we’d probably want to try and to cache these customized queries, and maybe that will even happen automatically. I’d have to dig into the code further to determine that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create custom logs queries’ is closed to new replies.