• Resolved Angela

    (@g33kg0dd3ss)


    Hello again! Still using this plugin, and still getting lots of useful data from it. ??

    I have a suggestion to fix the number formatting throughout (but I was especially looking to fix it in the sidebar widget that everyone sees). I realized that only the “Total Spams” count was formatted properly. To reformat all of the numbers, I went through and changed the following lines in functions.php:
    14 – Users online
    76 – Visits per [x]
    145 – Visitors per [x]
    212 – Pages/posts per [x]
    275 – Count per page
    582 – Searches
    643 – Number of posts
    655 – Number of pages
    665 – Number of comments
    678 – Total users
    706 & 710 – Average posts per day/days between posts
    727 & 731 – Average comments per day/days between comments
    748 & 752 – Average registrations per day/days between registrations

    I basically changed all instances of
    return $result;
    to
    return number_format_i18n($result);
    …and…
    return $wpdb->query("SELECT * FROM {$table_prefix}statistics_useronline");
    to
    return number_format_i18n($wpdb->query("SELECT * FROM {$table_prefix}statistics_useronline"));
    …and…
    return round( $days_spend / $get_total_post, 0 );
    to
    return number_format_i18n(round( $days_spend / $get_total_post, 0 ));
    …etc. ??

    https://www.ads-software.com/plugins/wp-statistics/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Greg Ross

    (@gregross)

    The functions return unformatted numbers so they can be used in other parts of the code (like to generate the javascript graphs) where formatted numbers are not supported.

    It is better to format them just before they are displayed (so in your example, in the widget code).

    I’ll add it to my list of things to do.

    Thread Starter Angela

    (@g33kg0dd3ss)

    Ah, gotcha! I was thinking that formatting them as early as possible in the flow of the code would help, but you make a good point. ?? I’ll un-tweak my functions.php and instead play around with shortcode.php.

    As always, thanks for the prompt response, and keep up the good work!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggested fix: Number formatting’ is closed to new replies.