This is a simple hack to make Ushahidi display only the current months worth of data. This is useful if you have a large dataset with no real need to display historical data to your users.
Modify application/controllers/main.php lines 327 onwards.
/* Commented out by John McLear */
// $first_month = 1;
// $last_month = 12;
/* Added by John McLear as to only show the current month of data */
$first_month = date('m');
$last_month = date('m');
/* End of new code */
$i = 0;
foreach ($query as $data)
{
$date = explode('-',$data->dates);
$year = $date[0];
$month = $date[1];
/* Added by John McLear */
// Only includes from the month we are in now, yes this sucks but it works
if ($month == $first_month){
// Set first year
if($i == 0)
{
$first_year = $year;
$first_month = $month;
}
// Set last dates
$last_year = $year;
$last_month = $month;
}
$i++;
}
There may be a bug with this when the month is January. It needs more testing.
Hello,
Sorry for coming here, but i’m a bit desperate with my Ushahidi. (badia-initiative.org).
The filter is not working at all. Color is not changing and the filter neither.
Could you have any ideas to help me?
Thanks in advance!
Eduardo