cuny-academic-commons / bp-event-organiser

Allows Event Organiser plugin events to be assigned to BuddyPress groups and generates a group calendar page for each group
GNU General Public License v2.0
3 stars 1 forks source link

New events are getting "edited" activity items #23

Closed boonebgorges closed 9 years ago

boonebgorges commented 9 years ago

This is now working, but it's pretty precarious. Because we're using an abstracted version of wp-admin on the front end, which uses an auto-draft post, it's very difficult to detect the creation of a new post through normal hooks like 'save_post' - they always come through as edits. My clunky solution is to use 'transition_post_status' to catch the publishing of new posts - 'bpeo_create_event' - and then rely on 'edit_post' to catch edit events. Let's see how it holds up :-D

r-a-y commented 9 years ago

By default, in the admin area, a WP post is an auto-draft. Later, WP uses autosave via JS to switch it to a draft.

I deliberately removed this autosave functionality for now because we do not have a frontend UI to manage drafts at the moment. Sorry for making you jump through hoops!

boonebgorges commented 9 years ago

Ha, no problem at all - your approach is elegant, it's just that when combined with the way that EO handles creating/editing items, it ended up being kinda odd. Anyway, it's working now :)