Events Made Easy › Forums › How do I … › eme_event_preinsert_filter
Tagged: filter, recurrence
- This topic has 4 replies, 2 voices, and was last updated 9 years, 8 months ago by Franky.
-
AuthorPosts
-
Mon 11 Aug 2014 at 23:40 #52655AnonymousInactive
I have created templates for determining the type of the event.
When I create a new event and do not want to use the default settings. I choose a template under the heading event format (Drop Down), this document specifies the type of event.I use the filter do insert templates for this type:
Single event format
RSVP
Email format
Event image
e.g. AttributesThis works well and is a great improvement
Now my problem.
If I create an event with recurrence and default settings, after I have pressed the Save button I see a gray screen. The code seems to stop.
If I click on event edit, only the first event of the series was added.
In this case, through the filter the contents of $event are not changed.
Without the filter there is no problem.Tue 12 Aug 2014 at 00:55 #52660FrankyKeymasterI just tried using this in my functions.php (basically not changing anything):
add_action('eme_event_preinsert_filter','do_my_stuff'); function do_my_stuff($event) { return $event; }
and I could create a recurrence just fine …
Edit: if the code stops, there’s a php error somewhere. Check your webserver error logfiles for clues.
Tue 12 Aug 2014 at 22:27 #52663AnonymousInactiveThe error reports are a problem, I can not access the reports.
OK, I have worked with add_filter, it works well, without recurrence.
Now I tested the whole thing with add_action, it does not work.
I can’t change the contents of $event.When I look at the file eme_events.php, I found the following code.
function eme_db_insert_event($event,$event_is_part_of_recurrence=0) { ... ... if (has_filter('eme_event_preinsert_filter')) $event=apply_filters('eme_event_preinsert_filter',$event); ... .. if (!$event_is_part_of_recurrence && has_action('eme_insert_event_action')) do_action('eme_insert_event_action',$event); return $event_ID; }
If I have found the correct code I think I need add_filter, here I can return a value.
The option with do_action provides no way to return a value.
I’m not a coder, my thoughts are correct?Tue 12 Aug 2014 at 23:15 #52666FrankyKeymasterNo sorry, it needs to be add_filter, not add_action. My bad.
Let me retest.Tue 12 Aug 2014 at 23:19 #52667FrankyKeymasterI added this to my functions.php:
add_filter('eme_event_preinsert_filter','do_my_stuff'); function do_my_stuff($event) { $event['event_name'].="test"; return $event; }
(just adding the string “test” to each new created event. Works fine for normal and recurring events.
-
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.