• Resolved 6logics

    (@6logics)


    ?lang=[code]&bpml_filter=true is added to all ajax urls except for heartbeat.
    The problem is that it adds question mark with these parameters if AJAX URL also have some parameters then parameters get disturbed.

    For Example in Compose message, when i type friends name then nothing returns, then I check console and parameters were passing like this:

    /wp-admin/admin-ajax.php?lang=en&bpml_filter=true?q=aaq&limit=10&action=messages_autocomplete_results&search_term=aaq

    Here, Question mark is repeating twice causing true?q=aaq as a value bpml_filter parameter instead of sending q as a separate parameter.

    I checked, you are using bp_core_ajax_url filter to achieve this. I think you should use some different approach.

    WP 4.7; BP 2.7.3; WPML 3.6.2; BPML 1.5.5.1

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor jozik

    (@jozik)

    Hi 6logics,
    thank you for investigating.

    After re-testing with basic setup – could not replicate issue you reported.
    When composing message, autocomplete returns correct results.

    It could be bug that appears under some circumstances.
    Can you please explain exact steps to reproduce issue?
    Which theme are you using?
    Are there some additional plugins?

    BPML uses WP built-in function add_query_arg()
    to filter BP AJAX URL, which should parse URL correctly (safely add args)
    https://developer.www.ads-software.com/reference/functions/add_query_arg/

    At my tests – URL parameters are added correctly:
    admin-ajax.php?lang=fr&bpml_filter=true&q=s&limit=10&action=messages_autocomplete_results&cookie=bp-activity-oldestpage%253D1

    Thread Starter 6logics

    (@6logics)

    Thank you Srdjan for quick reply.

    Yes, I am using some additional plugins and one of them is BuddyPress Global Search which is also adding parameter search_term to this ajax request.

    Let me check if issue is caused by this plugin.

    Regards,
    M. Aaqib Khan

    Thread Starter 6logics

    (@6logics)

    Yes issue is in BuddyPress Global Search plugin. Thank you for your help. I will create support on that plugin form.

    Plugin Contributor jozik

    (@jozik)

    Thank you.
    You can also suggest them to use add_query_arg().

    Thread Starter 6logics

    (@6logics)

    Sorry to disturb you again.
    But I just found another bug due to this issue.
    In groups, when you suggest user, ajaxurl is broken here to:

    admin-ajax.php?lang=en&bpml_filter=true?action=bp_group_admin_member_autocomplete&group_id=12

    File: wp-content\plugins\buddypress\bp-groups\admin\js\admin.js Line: 14

    So, you can’t change ajaxurl. Whenever, someone uses ajaxurl + '?someparam=someval' in JS file, the ajax request brokes.

    I think you need to fix this because whoever uses ajaxurl + '?', the ajax request fails.

    And you are using add_query_arg() in bp_core_ajax_url filter to modify ajaxurl throughout the site.

    I think, may be using bpml_filter and lang parameter as post parameter will be better.

    Thank you Srdjan for your assistance!

    Plugin Contributor jozik

    (@jozik)

    @6logics Where I can see that example of autocomplete?
    I looked at group screens and cannot find it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘bpml_filter with question mark is added to all ajax request’ is closed to new replies.