CollabPress
CollabPress copied to clipboard
No tasks displayed on calendar.
None of the tasks are shown on the calendar.
The issue is in functions.php, line 311:
$formatDate = $year . '-' . str_pad( $month, 2, 0, STR_PAD_LEFT ) . '-' .str_pad( $list_day, 2, 0, STR_PAD_LEFT ) . ' 00:00:00';
Which results in the following: 2013-06-15 00:00:00
This however is not how CollabPress dates in the database. The database stores the following: 6/15/2013
Thus when running the query on the database for a task on a certain date, there is always zero results.
The fix seems obvious. By changing $formatDate to the following it should work.
$formatDate = $month .'/' . $list_day . '/' . $year;
However: Not sure what the "Date Format" in the admin menu does, for me it stays on "Custom" no matter what you select. Is this supposed to be how the date is stored? The resulting issue with this is that it seems to be that the above code is static and thus will always require the same format.
In regards to this, there seems to be an inconsistency with how the date is initially stored when a task is created. And how the date is stored after a task is edited.
Task added (content-single-project-tasks.php): Display selector box:
<tr valign="top">
<th scope="row"><label for="cp-task-due"><?php _e('Due: ', 'collabpress') ?></label></th>
<td><p><input name="cp-task-due" class="cp-task-due-date" id="cp-task-due-date" class="regular-text" type="text" value=<?php echo date('n/j/Y') ?> /></p></td>
</tr>
Grab and store data:
jQuery('#cp-task-due-date').datepicker( {dateFormat: 'm/d/yy'} ); // init the datepicker
var data = {
task_due_date: $('#cp-task-due-date').val(),
Task edit (content-single-task.php): Display selector box:
<tr valign="top">
<th scope="row"><label for="cp-task-due"><?php _e('Due: ', 'collabpress') ?></label></th>
<td>
<p>
<input name="cp-task-due" class="cp-task-due-date" id="cp-task-due-date" class="regular-text" type="text" value=<?php echo cp_get_the_task_due_date(); ?> />
<input id="cp-task-due-date-formatted" type="hidden" value="<?php echo str_replace( ' 00:00:00', '', cp_get_task_due_date_mysql( cp_get_task_id() ) ); ?>" />
</p>
</td>
</tr>
Grab and store data:
jQuery('#cp-task-due-date').datepicker( {
altFormat: 'yy-mm-dd',
altField: '#cp-task-due-date-formatted',
dateFormat: '<?php echo cp_translate_date_format_for_js_datepicker() ?>'
})
.datepicker( 'setDate', '<?php echo cp_get_task_due_date( cp_get_task_id() ) ?>' ); // init the datepicker
var data = {
task_due_date: $('#cp-task-due-date').val() + ' 00:00:00',
This is definitely a bug and one I'd like to see fixed in v1.3.2