Support » Plugin: Events Manager - Calendar, Bookings, Tickets, and more! » Get raw search result data

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    here’s another thread which may help you with this – http://wordpress.org/support/topic/simplest-way-to-get-all-events-as-an-array?replies=6

    Thread Starter raincoven

    (@raincoven)

    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.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    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

    Thread Starter raincoven

    (@raincoven)

    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.

    Plugin Support angelo_nwl

    (@angelo_nwl)

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

    Thread Starter raincoven

    (@raincoven)

    Yes, you understand me correct.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    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/

    Thread Starter raincoven

    (@raincoven)

    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.

    Thread Starter raincoven

    (@raincoven)

    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.

    Thread Starter raincoven

    (@raincoven)

    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.

    Hi @raincoven

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

    Thanks in advance

    Thread Starter raincoven

    (@raincoven)

    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.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Get raw search result data’ is closed to new replies.