• Resolved AJD

    (@ajd)


    We have several thousand users that create events, but when we delete past events, the locations for those events still are saved. How can we see which locations do not any past or upcoming events attached to them so we can delete them?

    The page I need help with: [log in to see the link]

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

    (@angelo_nwl)

    Hi,

    You can use a custom SQL command to delete locations and then you can match it from wp_em_events location_id.

    Thread Starter AJD

    (@ajd)

    I’m not sure I understand. How to identify which locations do not have any events attached to them?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    As I’ve said above you can use a custom SQL command

    e.g. this will show you locations that don’t have events (includes all past and future events)

    
    SELECT * FROM wp_em_locations, wp_posts WHERE wp_em_locations.post_id = wp_posts.ID AND wp_em_locations.location_id NOT IN (SELECT location_id FROM wp_em_events WHERE location_id IS NOT NULL)
    

    You can improve this SQL command since this is just to give you an idea. You can then change SELECT * To DELETE DELETE wp_em_locations, wp_posts

    **before doing any SQL, make sure you have a backup of your database and might need professional help if you are not comfortable using the SQL command on your site.

    https://eventsmanagerpro.com/support-policy/

    • This reply was modified 3 years, 10 months ago by angelo_nwl.
    • This reply was modified 3 years, 10 months ago by angelo_nwl.
    Thread Starter AJD

    (@ajd)

    Okay thanks. I was hoping there was a way within Events Manager, which seems like a good idea, even a column in the locations admin page which would show which locations have events and which do not…

    Plugin Support angelo_nwl

    (@angelo_nwl)

    I’m going to let the Devs know about this, adding event count column under Events > locations

    Thread Starter AJD

    (@ajd)

    Thanks, this or another way to manage unused locations would be great. The underlying issue that we need to address is that locations without events still show up on the events location drop down, country. So if there was an event, but then it passed and was deleted for New Zealand, New Zealand still shows up in the events country drop down.

    Hello AJD,

    Thanks for your response! I’ll check on it and also add it to the devs log which Angelo mentioned.

    Thank you!

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Hi, unfortunately this sort of feature won’t happen anytime soon, but what you could do now also is use shortcodes to show the eventless location and delete them one by one (cumbersome, I know, but it’s a way to do it)

    [locations_list eventful=”0″]

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to delete locations that do not have an event?’ is closed to new replies.