#3300 closed Enhancement (fixed)
add event after river item has been added
| Reported by: | cash | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.8.1b |
| Component: | Core | Version: | Github Master |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: | easy |
Description
As discussed with hellekin
Change History (8)
comment:1 Changed 2 years ago by ewinslow
comment:2 Changed 2 years ago by cash
I'm not a big fan of deleting something after it is created. I think that's a bad pattern. In general there should be a hook before something is created and an event after. If someone wants to prevent something use the hook. The event should be more of a "hey, this has happened". Otherwise, you introduce nasty plugin order dependencies (notifications sent out before an object is deleted).
comment:3 Changed 2 years ago by ewinslow
Indeed. That makes sense as a rule of thumb. What would returning false from a create event then indicate?
comment:4 Changed 2 years ago by cash
stops any other event handler from running. not sure that is really needed or a good idea
comment:5 Changed 2 years ago by ewinslow
No reason this can't wait until the 1.8.1 release
comment:6 Changed 2 years ago by ewinslow
- Milestone changed from Elgg 1.8 to Elgg 1.8.1
comment:7 Changed 2 years ago by cash
- Resolution set to fixed
- Status changed from new to closed
(In [svn:9104]) Fixes #3300 adds a created,river event
comment:8 Changed 20 months ago by brettp
- Milestone changed from Elgg 1.8.1 to Elgg 1.8.1b

Would this just be something like:
if(elgg_trigger_event('create', 'river_item', $item)) { return true; } else { $item->delete(); return false; }