WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Get raw search result data (13 posts)

  1. raincoven
    Member
    Posted 6 months ago #

    Hello,
    I need to cut all of doubled events with different date from plugin buildin search result. For this I need to get raw search result data, delete excess events and output it without using plugin formatter.
    Is there any possibilities to do this?

    http://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 6 months ago #

  3. raincoven
    Member
    Posted 6 months ago #

    Thanks for advise, but it not what I am looking for. In thread that you suggested me just description how to get all of events but I need exact event search result stored in variable.

  4. angelo
    NetWebLogic Support
    Posted 6 months ago #

    yes, you can try something like this

    $EM_Events = EM_Events::get($args);
    foreach ( $EM_Events as $EM_Event ) {
     echo $EM_Event->event_id;
    }

    - this will give you the events list in array and then use foreach to get the objects

  5. raincoven
    Member
    Posted 6 months ago #

    The code, suggested bu tuo will give me all of events but I need search result. May be I describe my problem incorrect so lets look for example.
    I have "Party" event. It happen every week in friday. I look for "Party" in Search and it show me 10 absolutely equal "Party" events with different date. I need only one future event to be shown. I dont need to have others events except "Party" because I haven't search for them.
    I shouldn't to do additional request to database - search function already made it. I just need data.

  6. angelo
    NetWebLogic Support
    Posted 6 months ago #

    hmm, is this for recurring events? where you've wanted to show only one recurring events in the event searches?

  7. raincoven
    Member
    Posted 6 months ago #

    Yes, you understand me correct.

  8. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 6 months ago #

    you can get this to work by modifying the $args array so it's seomthing like:

    $args = array('limit'=>1, 'search'=>'Party');

    I think that'd return the soonest event by default, otherwise also add the order and orderby search attributes to the array. they're the same as described here- http://wp-events-plugin.com/documentation/event-search-attributes/

  9. raincoven
    Member
    Posted 6 months ago #

    Thanks Marcus, it is cool, but could I just get search result as array of events? Formatted output is not the thing that I need.

  10. raincoven
    Member
    Posted 6 months ago #

    Solution to use next code doesn't meet my goal.

    $args = array('limit'=>1, 'search'=>'Party');

    For example I have 3 recurring events. "Max Party", "Alex Party", "Dance party" and then I search for "Party" I should get all of listed events and result shouldn't contain more then one instance of each recurrence.

    Also I need search data to output some additional information.

  11. raincoven
    Member
    Posted 6 months ago #

    Ok, I resolve it. I just get search args from %_POST variable and make a custom request without using plugin buildin search.

    Thank for help.

  12. spatialy
    Member
    Posted 6 months ago #

    Hi @raincoven

    I try to resolve the same problem, it's possible you explain more your approach and solution of this??

    Thanks in advance

  13. raincoven
    Member
    Posted 6 months ago #

    I resolve it with next steps:
    1) I get search filter args from $_POST variable like this:

    $args = array();
     foreach ($_POST as $key=>$val) {
        if (!empty($val) && !empty($key)) {
            $args[$key] = $val;
        }
     }
     $events_obj = EM_Events::get($args);

    Keep in mind that default search form send to $_POST variable different array keys from used in EM_Events::get() function, so i made my custom form.

    2) So then I get all of events with applied search filter I just took all that i need with my custom function. $events = get_unique_events($events_obj);

    This is not the best decision but it work and plugin code shouldn't be modified.

Reply

You must log in to post.

About this Plugin

About this Topic