• I’ve set the Event Agenda to Group by Day.
    I am able to see the schedule for Mon, Tues, Wed and Thurs. I would also like to see Frid and Sat on the same page. However, I nee to select the right arrow to see Fri And Sat.

    What is setting this widget to show only 4 days. How can I change that to show 6 days?
    I looked through the code. Nothing is obvious.

    https://www.ads-software.com/plugins/event-organiser/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter tjsherlock

    (@tjsherlock)

    I figured out that the numbers of dates is hardcoded in the sql query in the file, event-organiser-ajax.php and the function eventorganiser_widget_agenda. I changed the LIMIT from 4 to 5 to and reset the first date displayed to be the Monday closest to the current date.

    However, when I click the next button to look at the next 5, nothing happens. So, clearly, I broke something. Any clue to help me reduce my wheel-spinning time?

    Thanks.

    function eventorganiser_widget_agenda() {
    
    /*. .  .  */
    $query['order'] = ($query['direction'] <1? 'DESC' : 'ASC');
    
    $query['quantity'] = 5; /* suggested code */
    
    		$key = 'eo_ag_'.md5(serialize($query)).get_locale();
    		$agenda = get_transient('eo_widget_agenda');
    		if( $agenda && is_array($agenda) && isset($agenda[$key]) ){
    			echo json_encode($agenda[$key]);
    			exit;
    		}
    
    		if( 'day' == $query['mode'] ){
    			//Day mode
    
                           $week_start_day = (int) get_option('start_of_week');  /* suggested code */
                           $event_day = (int) $today->format('w'); /* suggested code */
                           $week_start_date = $today->modify('- '.$event_day.' days');   /* suggested code */
    
    			$selectDates="SELECT DISTINCT StartDate FROM {$wpdb->eo_events}";
    			$whereDates = " WHERE {$wpdb->eo_events}.StartDate".( $query['order']=='ASC' ? " >= " : " <= ")."%s ";
    			$whereDates .= " AND {$wpdb->eo_events}.StartDate >= %s ";
    
                $orderlimit = "ORDER BY  {$wpdb->eo_events}.StartDate {$query['order']} LIMIT ".$query['quantity'];  /* suggested code */
    
                $dates = $wpdb->get_col($wpdb->prepare($selectDates.$whereDates.$orderlimit, $week_start_date, $week_start_date->format('Y-m-d')));  /* suggested code */
    
    /*. .  . */
                      }
    }
    Thread Starter tjsherlock

    (@tjsherlock)

    So, in an effort, to hunt down the code that moves the date forward after clicking the next button, I used Netbeans+XDebug. This is very frustrating because using the debugger seems to prevent the data refresh. Data only refreshes when I run the plugin without debugging.

    So, again, it would be appreciated if someone in the know pointed me to the relevant code.

    Would really like an answer to this also, as I would like to REDUCE the amount of days paginated to 2/3 as I have the widget embedded in a page and the height is too much.

    Not really being a coder I’ve only tried modifying basic modifications, which gets me halfway there.

    https://postimg.org/image/46zm00lm1/

    Changing the limit in event-organiser-ajax.php from 4 to 2 does seem to limit the days shown to 2. I also tested it with 6 to see if it worked for tjsherlock – it does (you have to clear browser cache after changing the LIMIT value)

    Line: 627

    $orderlimit = "ORDER BY {$wpdb->eo_events}.StartDate {$query['order']} LIMIT 2";

    this only works however when the nav buttons are pressed. It seems it recalculates the values – but on initial load it doesn’t and the LIMIT is ignored.

    Essentially I need a way of it doing the recalc when it first loads, but like I said, I’m not really a coder

    I actually think it was just a cache issue.

    It seems to be working perfectly on my site now with the LIMIT change

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Event Agenda Widget’ is closed to new replies.