elgg_count_comments() has incorrect use of plugin hook
|Reported by:||beck24||Owned by:|
Using the plugin hook comments:count, but presumably all plugin hooks.
When the function called by a plugin hook returns a value of (int)0 or (string)'0', the value is discarded and the original value is used. There doesn't appear to be any way to return 0 as a legitimate value. I've gotten around it by returning "<span>0</span>" so that it renders correctly on the page, but that's not ideal as another hook may want to perform other mathematical functions with the value.
Change History (3)
comment:1 Changed 2 years ago by cash
- Difficulty set to easy
- Milestone changed from Needs Review to Elgg 1.7.9
- Summary changed from plugin hook fails when 0 is returned to elgg_count_comments() has incorrect use of plugin hook