#5019 closed defect (bug) (fixed)
Fire 'friends_friendship_deleted' hook after delete friendship.
Reported by: | mukkundthanki | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.8 | Priority: | low |
Severity: | minor | Version: | 1.7 |
Component: | Friends | Keywords: | 2nd-opinion |
Cc: |
Description
In function 'friends_remove_friend', we fire 'friends_friendship_deleted' hook and then we delete friendship and then update friends total.
Actually I need friends total after friendship deleted. I can hook my function to 'friends_friendship_deleted' but total updates after it. My suggestion is
if ( $friendship->delete() ) { friends_update_friend_totals( $initiator_userid, $friend_userid, 'remove' ); do_action( 'friends_friendship_deleted', $friendship_id, $initiator_userid, $friend_userid ); return true; }
Change History (6)
#1
@
12 years ago
- Keywords 2nd-opinion added
- Milestone changed from Awaiting Review to 1.8
- Priority changed from normal to low
- Severity changed from normal to minor
#2
@
12 years ago
you are right on that, and i guess my suggestion is also improper because it will be useless of $friendship_id in hook which actually deleted. so, hook is right as its right now.we can make use of friendship details before its delete, but can we make one more hook which fire after successful deletion of friendship ?? like this
do_action( 'friends_friendship_deleted_success', $initiator_userid, $friend_userid );
so, we can make use of 'friends_update_friend_totals' function.
#3
follow-up:
↓ 4
@
12 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 7108:
Ugh, you are right, this looks like a mistake.
If we move it as you suggest, it's possible that we'll break plugins that are using the hook and depending on its odd behavior. However, I think it's pretty unlikely that we'd break them in a serious way - if anything, we may *fix* them in some cases. So I lean toward moving it as mukkundthanki suggests, but I'd like feedback from another dev before going forward.