Skip to:
Content
Pages
Categories
Search
Top
Bottom

Modifying Members AJAX Directory Search

  • Avatar of hatiro
    HaTiRo
    Participant

    @hatiro

    Hi,
    I’m upgrading to 1.6 and have been hit by AJAX… :( (not pleasant so far…).
    Whilst I can understand the flow of PHP, Mysql etc, this has me stumped.

    I need to restrict search terms to certain profile fields on the directory search.
    I managed this before by including a NOT IN statement in the search_users function in bp_core_classes.php
    Now that ajax_querystring seems to supercede this function where ajax is enabled, I’m at a loss to see how I can fulfil this objective.

    Does anyone know how to restrict searching in certain profile fields for member search terms in ajax?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of hatiro
    HaTiRo
    Participant

    @hatiro

    Coming at this from a different tack then.
    Does anyone know which function the Directory Search uses in order to accomplish the ajax querystring?

    Any pointers would be gratefully received.

    Avatar of hatiro
    HaTiRo
    Participant

    @hatiro

    OK found it! The Member Directory Search now passes values straight into the loop using ajax querystring, this gets its data from the main get_users function and doesn’t use the search_users function.

    Obviously I needed to modify the core to omit searching in certain profile fields by inserting ‘AND spd.field_id NOT IN (‘2′,’3′)’ into the sql before the search terms, but I understand that as of BP1.7 this will be reworked into BP_USER_QUERY and so will need changing anyway…

    As an aside will the exclusion of searches for profile fields be doable in this new user_query? The reason is that if you are using any form of security/visibility on profile fields then you don’t want to be able to search on them. Currently, even if the profile fields are not visible it will return the user with that data in their field if the invisible data is used.

    Avatar of shurikasa
    shurikasa
    Participant

    @shurikasa

    Hello, I’m looking for the place where the ajaxifying of Member Directory Search is implemented. Could you please give me a hint? Which files are you looking at? Thank you.

    Avatar of hatiro
    HaTiRo
    Participant

    @hatiro

    From what I remember, the ajax is done through the default theme _inc ajax.php file specifically the bp_dtheme_ajax_querystring() function found around line 91. This gains its data from the get_users() function found in bp-core bp-core-classes.php on line 201.

    This is for bp1.6 though, as stated above I understand this has changed now and is done differently, so perhaps someone who has looked at this in 1.7 onwards can add to this thread.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.