The MU forums have moved to WordPress.org

Vent plugin (2 posts)

  1. gighen
    Member
    Posted 16 years ago #

    Hi,
    i know the author of this plugin read this forum, so...
    is possible to show the last inserted event in a widget?? thank you

  2. cafespain
    Member
    Posted 16 years ago #

    Out of the box no. The only widgets in there are Next Event and Upcomming events.

    If you want to play add a function to the vent_core class underneath the getnextevent function called something like getlastaddedevent and duplicate the code from getnextevent in it.

    Next change the line:
    $sql .= "ORDER BY post_date ASC ";

    to
    $sql .= "ORDER BY post_modified DESC ";

    Near the top of vent_core, add:
    var $lastaddedevent;
    underneath
    var $nextevent;

    and in the getlastaddedevent function change every instance of $this->nextevent to $this->lastaddedevent

    and finally in the vent_widgets class change the line in the function vent_next_event that looks like:

    if($this->getnextevent())

    to

    if($this->getlastaddedevent())

    AND the line:
    $post = $this->nextevent;
    to
    $post = $this->lastaddedevent;

    And that will change the functionality of the next event widget to show the last added event instead. If you want both widgets, then it will require a bit more work and you will have to duplicate all of the widget setup, registration and display functions as well.

About this Topic

  • Started 16 years ago by gighen
  • Latest reply from cafespain