GEO my WP Support

Use this forum for technical support and general questions related to GEO my WP plugin and its core add-ons only. For technical support and general questions related to any of the premium extensions please open a new premium support ticket.

[Not resolved]Dynamic Search Results

Forums Support Dynamic Search Results

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #54975
    Paul
    Member

    Hi Eyal,

    I am trying to figure out how to generate search results based on the URL of a page.

    For example, a person visits a page mysite.com/barcelona/bags.
    I want to display search results on this page that returns bags in barcelona.

    My question is: how can I pass GMW search function some arguments that it can return on the fly without using a search form? I want to load the dynamic results when the page loads.
    Barcelona will be the location (obviously) and bags would be taken from a BP XProfile field.

    Can you suggest a function to use/manipulate?

    #54991
    Paul
    Member

    Bump.

    Would really appreciate some input on this if you have time.

    #54992

    Hi,
    This can be done, but there is no “simple” way to doit.

    You can create a form and use the “Page load results” tab to set the filters of the results that will be displayed when the page first loads. You can also disable the search form in the “Search form” tab.
    Doing that you will have a form that will display list of results on page load.

    As for the filters of the address and xprofile fields, you will need to use some hooks and custom functions.

    You will first need to pull the values of the address and xprofile field from the URL. Then, you can pass the address value to the form using the filter:

    which can be found in geo-my-wp/includes/geo-my-wp-gmw-class.php.
    You need to filter the form array and pass the address to the “page_load_results” value of the array.

    For the xprofile fields part you can use the filter:

    which can be found in geo-my-wp/plugins/friends/includes/gmw-fl-search-query-class.php. Using this filter you can modify the arguments ( $this->form[‘query_args’] ) that passes to the bp_has_members() function which responsible for the members query.

    It does require PHP and WordPress hooks knowledge, but the above should be a start point.

    I hope that helps.

    #55675
    victorr
    Member

    Hi Eyal,

    A lot of thanks for your plugin.

    I´m trying to do what you recommend to create a form with dynamic cities depending on the user. In the web, in a previous form, user selects a city and it´s sended to database. So, i can create a variable to return the city selected by the user. The problem is that I don´t know exactly where I have to insert this variable in the “page_load_results”. I have tried adapting $this->form[‘org_address’] but i haven´t been able to get it.

    Could you give me some input more about it.

    Thanks,

    Victor

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

You must be logged in to reply to this topic.