If you want to get a list of repeating events, normally you dont want to see anything but the first of those events - so you need something to filter to get "just" the first event.

Unfortunately it's not quite that easy because of the way the data is stored. The way I have achieved this is to join the event_repeat_nodes table, then join the even_repeat table, then add a when clause to check that the repeat data (which is serialized) has in it a string matching nid.... and the nid you are looking for. Still not as easy as that, as the nid value is sometimes stored as an int, and sometimes as a string. - Oh joy

  $query->add_where("LOCATE(CONCAT('s:3:\"nid\";i:', CAST(node.nid AS CHAR)),event_repeat.repeat_data) OR LOCATE(CONCAT('s:3:\"nid\";s:',CAST(LENGTH(CAST(node.nid AS CHAR)) AS CHAR),':\"', CAST(node.nid AS CHAR)),event_repeat.repeat_data)");

It works for me.

I haven't tried the patch on the 2.x branch yet - sorry.

CommentFileSizeAuthor
eventrepeat.firstevent.patch1.6 KBmarkfoodyburton

Comments

asifanwar98’s picture

Hi I would just like to say the functiobality this patch would add is great and I think it would be very usefull to loads of people including myself. The ability to filter event nodes by wither they are the first nodes, would be a great addition to this module, becouse it would solve the problem of not being able to limit the events shown on the frontpage, when an event is set to repeat and also promoted to the frontpage, to only the first event.

Thanks loads markfoodyburton.

Just for my intrest, I'd just like to ask you if you could explain the last line:

$query->add_where("LOCATE(CONCAT('s:3:\"nid\";i:', CAST(node.nid AS CHAR)),event_repeat.repeat_data) OR LOCATE(CONCAT('s:3:\"nid\";s:',CAST(LENGTH(CAST(node.nid AS CHAR)) AS CHAR),':\"', CAST(node.nid AS CHAR)),event_repeat.repeat_data)");

if possible, sepifically the SQL

thanks,
Asif

spython’s picture

Works for me, but showing only the first events of repeating events. And nothing more.
Is there a way to show all non-repeating events too?

spython’s picture

I guess similar functionality could be achieved with Event Repeat Views module, which is not working at all for me.

spython’s picture

Okay, after a few tries and following the hack described here and changing the view filter to "distinct" I managed to have a list of nonrepeating events with only the first of the repeating items.

rmiddle’s picture

Need to look at this and see if it can be incorporated in.

Thanks
Robert

oadaeh’s picture

Status: Needs review » Closed (won't fix)

This issue is being closed due to age and/or version. If this issue is still valid, please reopen it against the 6.x-1.x branch and update it. There will be no more follow ups against the 5.x branches.