Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong spam statistics in dashboard #290

Closed
Zodiac1978 opened this issue Oct 29, 2019 · 0 comments
Closed

Wrong spam statistics in dashboard #290

Zodiac1978 opened this issue Oct 29, 2019 · 0 comments
Labels
Milestone

Comments

@Zodiac1978
Copy link
Member

@Zodiac1978 Zodiac1978 commented Oct 29, 2019

I stumbled upon an interesting bug.

I have 48719 spam comments blocked so far. This is what is in my database.

But the dashboard counter says I have 48 blocked. This little difference made me curious. What is happening here?

But everything is working fine. If I output the counter it says correctly "48.719". Wait!? Why is there a period?

Well because of this line of formatting:

return ( get_locale() === 'de_DE' ? number_format( $count, 0, '', '.' ) : number_format_i18n( $count ) );

So what happens in the dashboard widget? There is this placeholder %d:

__( '%d Blocked', 'antispam-bee' ),

And this placeholder %d means this value is an integer. The integer of "48.719" is "48".

Problem solved! What's the solution? We just need to change this to %s for string (there is also %f for float, but this is adding zeros at the end and is semantically wrong here).

PR is coming soon.

@websupporter websupporter added this to the 2.9.2 milestone Oct 30, 2019
websupporter added a commit that referenced this issue Oct 30, 2019
Change placeholder from integer (%d) to string (%s) - fixes #290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.