• Resolved Fee

    (@wdfee)


    Hi Marcus,
    the search form for the events list doesn’t work when locations are disabled. All searches show “no events”.
    In debug I get a deprecated warning: like_escape is deprecated (found in em-object.php line 161), should use $wpdb->esc_like() instead.
    But that’s not the solution yet, it still shows no events (after I replaced this call).
    I checked out the sql call of the output_grouped() function. It queries the location table – but this is empty if locations are disabled in settings.

    https://www.ads-software.com/plugins/events-manager/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi,

    Which version of Events Manager are you using?

    Thread Starter Fee

    (@wdfee)

    EM 5.5.3.1
    WP 4.0
    EM settings: locations disabled
    EM search settings: advanced search enabled, category search enabled,
    all other (geolocation, distance, country, region etc.) disabled

    The sql call is exactly in /classes/em-events.php neither in output_grouped() nor in output() but in the from both called get() function, querying the locations table in line 27, 51, 81 and maybe more.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    hmm, this works for me; do you have sample link to your site for us to see?

    Thread Starter Fee

    (@wdfee)

    The site is not public yet. I can give you access per mail.

    If you had locations enabled and now only disable for testing you won’t have the same environment, as the events in this case already have locations. If you set up a new site, or just a site without EM before, and start setting it up without locations, the locations table will be empty and cannot be queried.
    Please look into the code, I gave you the file name and line numbers. EM queries the events table and locations table for the same event_id. This can impossibly work if locations table is empty (what is the case if locations are disabled).

    I’m having the same problem. I noticed that search worked for some event categories and not for others.

    Lack of a location seems to be the reason.

    If ” This event does not have a physical location.” is checked, the event doesn’t show up in search.

    Try this. Go to https://www.northshorehikers.org. Click Schedule. You won’t see locations as they are hidden if you are not logged in. Click Advanced Search and look for Back-counrty Ski events. You will find none, but the schedule clearly has them. Now try A Hikes, search will work. The only difference is that Back-country Ski events don’t have locations.

    Please don’t dismiss Fee’s comments with a “this works for me.” She has uncovered a bug and “This doesn’t work for me.”

    Plugin Support angelo_nwl

    (@angelo_nwl)

    Fee,

    sorry but this works on my test site and cannot replicate this issue; however, did you assigned default location country?

    Thread Starter Fee

    (@wdfee)

    Yes, I assigned a default location country.

    roysmith gave you an example link, direct link is here: https://northshorehikers.org/schedule/schedule-list/
    Try advanced search as roysmith described with selecting category Back-country Ski. No events.
    Or try this, reload https://northshorehikers.org/schedule/schedule-list/ and look at the list, you see some Back-country Ski events in it. Then select “All Categories” in advanced search and these events are gone.

    Did you set up a new site as test site?
    Did you turn locations of at setup?
    Even if not, did you add some new events without loction as in roysmith’s case?
    Did you check in the database, if there’s content in the locations table?
    Did you compare if the events, that seem to have no location at your test site, but show up at category search at your test site, have an entry in the locations table?

    I’m still not able to replicate this, even with a fresh install of WordPress and Events Manager, and with locations deactivated from the beginning.

    The wp_em_locations table is empty, so that’s not the issue.

    Are you using any custom code / templates for Events Manager? Do you get the same results when running the default WordPress theme and with all other plugins deactivated?

    Thanks for looking into this.

    I’ll try deactivating plugins etc, and report back.

    Thread Starter Fee

    (@wdfee)

    all plugins except EM deactivated, doesn’t work – neither with TwentyTwelve, nor TwentyThirteen, nor TwentyFourteen.

    I stepped in /classes/em-events.php and did a print_r($sql), took this sql query directly into phpmyadmin – the result is empty.
    This is the query:

    SELECT wp_em_events.post_id FROM wp_em_events
    LEFT JOIN wp_em_locations ON wp_em_locations.location_id=wp_em_events.location_id
    WHERE (<code>recurrence</code>!=1 OR <code>recurrence</code> IS NULL) AND ( event_start_date >= CAST('2014-11-19' AS DATE) OR (event_end_date >= CAST('2014-11-19' AS DATE) AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL)) AND location_country='DE' AND (<code>event_status</code>=1)
    GROUP BY wp_em_events.post_id ORDER BY event_start_date ASC, event_start_time ASC, event_name ASC

    Ok, got it – I deleted the AND location_country='DE' and get the correct results. So I switched back to WP into the EM settings for search formular and set default country to “no default country”.

    I think, roysmith needs the default country as he has other events with locations.

    Hi,

    No luck. Still does not display events with no location.

    I have tried with almost all plugins disabled. I need Advanced Custom Fields and ezPHP enabled to have the site run.

    Settings:
    default location -> no default location
    default country -> no default country
    enable locations -> yes
    require locations for events -> no
    Use dropdown for locations -> no
    Enable location attributes -> no
    Enable location custom fields -> no

    Resaving the settings as listed above got the search working.

    I didn’t change settings, I just opened settings for Formatting > events and General > general_options and saved both. I stumbled on this by accident moving back and forth between my localhost test site and the live site, checking that the settings matched.

    Clearly something isn’t right. I’ll monitor this to see if it breaks again.

    It explains why it is difficult to reproduce. But it remains a real problem.

    Quit working. Resaving settings doesn’t get it going.

    Still haven’t been able to reproduce this. Do you have a default country set? Does changing or removing it make any difference?

    I have tried it both ways. Normally I don’t have a default country set. It makes no difference.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Search doesn't work when locations are off’ is closed to new replies.