I am trying to create a view (in this case, a block) that will only show events whose start dates are no older than a certain period of time. This is being done by setting the "Value" field for "Event: Start Date" to either a fixed date or the current time ("now"). Depending on what it is set to, either all events are shown (regardless of their start date) or none of them are shown - I have not been able to set it up to only show those particular events.

If I put a number in the "Options" field (I assume is where the "delta" value goes), it also shows this warning:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<event_start_time> + <delta>)) ORDER BY event_event_start ASC LIMIT 0, 5' at line 1 query: SELECT node.nid, event.event_start AS event_event_start, event.event_end AS event_event_end, event.timezone AS event_timezone, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN event event ON node.nid = event.nid WHERE (node.type IN ('event')) AND (node.status = '1') AND (event.event_start <= (<event_start_date> <event_start_time> + <delta>)) ORDER BY event_event_start ASC LIMIT 0, 5 in <path_to>/drupal/includes/database.mysql.inc on line 172.

Is this a bug, or is there something wrong with the filter I set up for this view?

Thank you for any help you can provide regarding this issue.

Comments

Wolfey’s picture

(Bumping topic...)

Is there any sample data I can try out for this? Either I overlooked something or this is a bug.

Wolfey’s picture

(Bumping topic...)

As a workaround, I've removed that view and put the calendar table in its place. However, I would still like to know if there is anything that can be done about this issue.

Wolfey’s picture

Recently, I created a view for a different node type, using the CCK "Date - To Date" field, and this issue does not occur there. Also, its "delta" value works properly, without generating this warning, when placed in the "Option" field.

Since it works properly there, I'm pretty sure the behavior I'm seeing here with Event Views is a bug.

Wolfey’s picture

After updating Event (and Event Views) to the most recent "dev" version, adding a "delta" value in the "Option" field no longer generates the above warning. However, the issue with showing all/no events is still present.

killes@www.drop.org’s picture

Status: Active » Postponed (maintainer needs more info)

I've today set up a view similar as you describe and it works just fine.

Can you try this one?

$view = new stdClass();
$view->name = 'my_view';
$view->description = 'next events';
$view->access = array (
);
$view->view_args_php = '';
$view->page = FALSE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'node';
$view->url = '';
$view->use_pager = TRUE;
$view->nodes_per_page = '3';
$view->block = TRUE;
$view->block_title = 'events';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '';
$view->block_empty_format = '1';
$view->block_type = 'list';
$view->nodes_per_block = '10';
$view->block_more = FALSE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'event',
'field' => 'event_start',
'label' => '',
'handler' => 'event_views_handler_field_date_custom_iso',
'defaultsort' => 'DESC',
'options' => 'd.m.Y',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'event',
),
),
array (
'tablename' => 'event',
'field' => 'event_start',
'operator' => '>',
'options' => '',
'value' => 'now',
),
);
$view->exposed_filter = array (
);
$view->requires = array(event, node, term_node);
$views[$view->name] = $view;

Wolfey’s picture

With the most recent "dev" release for Event, these issues no longer occur. The view you posted works properly - only events that match the filter rules ("Event: Start Date" in particular) are shown, rather than showing all/no events regardless of the filter rules. Adding a "delta" value in the "Options" field works properly as well.

Setting the "Value" field for "Event: Start Date" to a fixed date still does not show any events, though - otherwise, I would have changed the status for this issue to "fixed".

Pepe Roni’s picture

but what still does not work is when you supply an option to the event_start...

edited:

Works well even with option! Sorry for this post!

killes@www.drop.org’s picture

Project: Event » Event Views
Component: Event Views » Code

moving