[wp-trac] [WordPress Trac] #36901: Removing wp_die() from wp_allow_comment()
WordPress Trac
noreply at wordpress.org
Fri Oct 7 07:09:51 UTC 2016
#36901: Removing wp_die() from wp_allow_comment()
-------------------------------------------------+-------------------------
Reporter: websupporter | Owner:
Type: enhancement | websupporter
Priority: normal | Status: reviewing
Component: Comments | Milestone: 4.7
Severity: normal | Version: 4.6
Keywords: has-patch needs-testing has-unit- | Resolution:
tests | Focuses:
-------------------------------------------------+-------------------------
Comment (by websupporter):
I think we can't just get rid of the `check_comment_flood` action and the
hooked in function `check_comment_flood_db()` as a lot of installations
unhook this. So Boone suggested:
>`check_comment_flood_db()` is now just a wrapper for an `add_filter()`
call, which attaches the *actual* comment flood checking function to the
new `wp_is_comment_flood` filter. (Phew.)
I think this whole `wp_allow_comment()` has actually a lot of Phews :D
>I wouldn't personally bother with updating the older action.
This was my attempt in 36901.2.patch. But this implies to get rid of the
action and simply replace it with a filter. When I read the patch now, I
don't remember why I wrapped the `check_comment_flood_db()` into the
`check_comment_flood_db_filter()` back than, but seems not to be important
for the point here :)
>The other backwards-compatibility issue I can think of is that now
calling function check_comment_flood_db() will effectively do nothing,
whereas previously it actually checked for a comment flood and "died" if
one was detected. Developers may be relying on that behaviour.
Hmm... If this is an issue we could give `check_comment_flood_db()` again
its parameters and add the `$avoid_die`. If `$avoid_die` is true we could
add the filter and with `false` we call `wp_check_comment_flood()`
directly... (Phew ;P)
Will upload two patches. the first one just fixes the `@return` doc of
`wp_check_comment_flood()` (Does not return a WP_Error). The 2nd will
extend `check_comment_flood_db()`. I seperate those, because maybe someone
has a better idea for the 2nd patch or it's not an issue at all (or not
such an big issue, maybe... ?)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36901#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list