• Resolved webtecky

    (@webtecky)


    When opening a webinar for editing, the AJAX action ‘wpws_get_pages_and_posts’ fails because it tries to return ALL the published posts and pages. This is not only a poor thought and bad performance, but also it’s very bad and fails on websites with a lot of posts. Can this be addressed ASAP on the PRO version?

    Snippet of Uri, AJAX action and callback function:

    //URI
    /wp-admin/admin.php?page=wswbn-webinars&webinar_id=588390
    // AJAX call
    add_action(‘wp_ajax_wpws_get_pages_and_posts’, [‘WebinarSysteemAjax’, ‘get_pages_and_posts’]);
    // Callback function from\wp-content\plugins\wpwebinarsystem\includes\class-webinarsysteem-ajax.php

    public static function get_pages_and_posts()
        {
            WebinarSysteemJS::check_ajax_nonce();
    
            function title_filter($where) {
                global $wpdb;
    
                // this is messy, there must be a way to pass $query into the filter?
                $query = empty($_POST['query']) && $_POST['query'] != ''
                    ? null
                    : strtolower($_POST['query']);
    
                if ($query != null) {
                    $where .= ' AND '.$wpdb->posts.'.post_title LIKE \'%' . esc_sql(like_escape($query)).'%\'';
                }
                return $where;
            }
    
            add_filter('posts_where', 'title_filter', 10, 2);
    
            $posts = get_posts([
                'post_type' => ['page', 'post'],
                'posts_per_page' => -1,
                'orderby' => 'post_title',
                'order' => 'ASC',
                'suppress_filters' => false
            ]);
    
            remove_filter('posts_where', 'title_filter', 10);
    
            self::return_data(
                array_map(function ($row) {
                    return [
                        'id' => (int)$row->ID,
                        'title' => $row->post_title
                    ];
                }, $posts)
            );
        }
    • This topic was modified 2 years ago by webtecky.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Ruel

    (@ruel214)

    Please contact us directly so that our technical team can better assist you with this issue. You can reach us using the link below. Also, please make sure you provide your license key when contacting support for assistance.

    https://webinarpress.com/support/

    Thread Starter webtecky

    (@webtecky)

    The problem is also in the free version. Why are you ignoring these technical details and remind everything to the the PRO support? Please, address the problem in here, please.

    Plugin Author WebinarPress

    (@webinarpress)

    Hi there,

    > Why are you ignoring these technical details and remind everything to the the PRO support?

    It is against the www.remarpro.com rules for us to support pro users on this forum so if someone asks for pro support we need to ask them to contact us via our site.

    > The problem is also in the free version.

    I see this function is in the free version as well but it is not used. Thanks for pointing that out. We’ll get it removed from the free version in the next update.

    Plugin Author WebinarPress

    (@webinarpress)

    Hi again,

    I just wanted to let you know that we are working on an update that will address this in the pro version.

    As I mentioned earlier we can’t support the pro version here but you should should be notified in your WordPress admin when the update has been released, otherwise please send us an email using this page and we’ll be happy to let you know when the update has been released.

    https://webinarpress.com/support/

    Thanks again for pointing this out.

    Thread Starter webtecky

    (@webtecky)

    Much appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Ajax call fails’ is closed to new replies.