Events Made Easy Forums How do I … A few things (trying to extend the plugin)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #42120
    Anonymous
    Inactive

    I have an event page and in the sidebar there is a list of categories (kind of like you might have on a frontpage). I was using dbem_get_categories() to pull all the categories in the database. The problem was it was pulling some categories for events that came and went (especially during dry months). The result was the user would click the category and get a ‘no events for this date’.

    So I created this function:

    function get_open_categories(){

    global $wpdb;

    $event_table = ‘wp_dbem_events’;

    $categories_table = ‘wp_dbem_categories’;

    $sql = “SELECT DISTINCT category_name FROM wp_dbem_categories, wp_dbem_events WHERE ( wp_dbem_events.event_category_id = wp_dbem_categories.category_id ) && ( event_end_date >= CURDATE() )”;

    $open_cats = $wpdb->get_results($sql, ARRAY_A);

    return $open_cats;

    }

    And it works great. I pasted it in my functions.php but when I try to paste it into the marcus-extras.php some sort of error where the page is not totally rendered. No PHP spitting out error codes, but the HTML box where it is called doesn’t show up.

    I’ve never written a plugin, so I don’t know why that it happening. Can someone chime in on this?

    #44872
    Anonymous
    Inactive

    I’ve also extended this for locations:

    function get_open_locations(){

    global $wplogger;

    global $wpdb;

    $event_table = ‘wp_dbem_events’;

    $categories_table = ‘wp_dbem_categories’;

    $sql = “SELECT DISTINCT location_name FROM wp_dbem_locations, wp_dbem_events WHERE ( wp_dbem_events.location_id = wp_dbem_locations.location_id ) && ( event_end_date >= CURDATE() )”;

    $open_cats = $wpdb->get_results($sql, ARRAY_A);

    return $open_cats;

    }

    #44873
    Franky
    Keymaster

    Well … I don’t know what version you’re using, but the file called “marcus-extras.php” is no longer part of the code. That’s probably why it fails on you: you call a function that just isn’t there …

    #44874
    Anonymous
    Inactive

    Ahh. Old plugin folder.. yikes.

    #44875
    Anonymous
    Inactive

    Deleting the old plugin doesn’t delete the database does it?

    #44876
    Anonymous
    Inactive

    Nope it doesn’t.

    #44877
    Anonymous
    Inactive

    This is just what I was looking for – only, I’m a PHP-illiterate. I’m getting a call to undefined function. Is there some add_action or init missing for the functions.php?

    #44878
    Franky
    Keymaster

    There’s no funtions.php included in events-manager.php. If you want these functions, add them to one of the existing files. Or if you want a file functions.php, make sure it gets included in events-manager.php. Eg. add a line

    include(“functions.php”);

    after

    include(“eme_attributes.php”);

    in that file.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top