WordPress.org

Ready to get started?Download WordPress

Forums

StatPress Visitors
[resolved] [Plugin: Statpress Visitors] Tag not working and Widget Problem (11 posts)

  1. MarkvanDark
    Member
    Posted 3 years ago #

    Hi,

    I found a problem with StatPress V: if I use the available tag %todayvisitors% nothing is printed. It seems that this tag is not filled with data.

    Furthermore, the widget does not use the background of the theme. If you have, e.g., the archive widget the background is different from the page to indicate the area of the widget. This is missing in this widget.

    Best regards,

    Markus

    http://wordpress.org/extend/plugins/statpress-visitors/

  2. MarkvanDark
    Member
    Posted 3 years ago #

    Today I had time to check the plugin. I found the error:

    in line 1049 the variable today is set like the following: "$today = gmdate('Ymd', current_time('timestamp'));"

    The problem is, that the variable $today is needed for the SQL query for "todaysvisitors", "todayspageviews" etc.

    $today is only filled if the tag %today% is used somewhere.

    If you move line 1049 to line 1047 which means that today is always set the plugin works as suspected.

    The only thing I am still working on is the background as the widget used
    <li></li>
    instead of

    <li>
    <ul></ul>
    </li>

    which tells wordpress to use another style from the CSS.

    Best regards,

    Markus

  3. luciole135
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,
    I have nothing changed on the widget it is the original version of StatPress who works here.
    For variables, I'll watch it.
    best regard

  4. MarkvanDark
    Member
    Posted 3 years ago #

    Hi,

    I never said that it does not work. It works perfectly fine but only the today tags are not working.

    And the background style of the widgets are only a question of style. I resolved this problem by putting around the text withing the widget the list-tags from HTML and it works fine.

    Best regards,

    Markus

  5. MarkvanDark
    Member
    Posted 3 years ago #

    Hi,

    I updated today to version 1.4 and found that the tags are still not working.

    I checked again the statpress.php and detected that the issue still exists. Here are my suggestions again, I tested it and as far as I can see it does not break any functionality:

    Change the following code from:

    function luc_StatPress_Vars($body)
           {global $wpdb;
            $table_name = $wpdb->prefix . "statpress";
    
            if (strpos(strtolower($body), "%today%") !== false)
                 {$today = gmdate('Ymd', current_time('timestamp'));
                  $body = str_replace("%today%", luc_hdate($today), $body);
                 }
    ...

    to:

    function luc_StatPress_Vars($body)
           {global $wpdb;
            $table_name = $wpdb->prefix . "statpress";
            $today = gmdate('Ymd', current_time('timestamp'));
            if (strpos(strtolower($body), "%today%") !== false)
                 {
                  $body = str_replace("%today%", luc_hdate($today), $body);
                 }
    ...

    This makes all SQL queries work that use $today which is currently not the case!

    Best regards,

    Markus

  6. luciole135
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,
    This is very strange, on my website and local all variables work!
    The only error is the variable %visits% which was replaced by %todayvisitors% and %todaypageviews% but that appears when you install the widget.
    I can not reproduce this error, or correct it if necessary.
    Best regards

  7. MarkvanDark
    Member
    Posted 3 years ago #

    Hi,

    yes, this is really strange. Do you use the %today% tag? If yes then this is the problem that you cannot reproduce it. For testing I also defined once %today% and everything worked afterwards by I do not want to present the date to the visitors. When you are looking at the code you can see the problem with the variable, as the line

    $today = gmdate('Ymd', current_time('timestamp'));

    defines the variable needed.

    I have tried it again with the following text in my widget:

    Visitors online: %visitorsonline%<br>
    Visitors today: %todayvisitors%<br>
    Visitors total: %totalvisitors%

    The second line is empty, so the SQL does not return anything becuase the querystring is empty as you use the querey select ... where date = $today and ... (only a short snipped and not PHP conform)

    Best regards,

    Markus

  8. luciole135
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,
    I just try it on my website and you can see that these variables work.
    I do not know why it does not work for you!
    i'm so confused.

    best regards

  9. luciole135
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,
    now i understand you.
    In the next version i correct this.
    Best regard.

    I'm so sorry, my english is very bad (i use google translate) and I am not very interested in the variables because I do not use them on my site (except for testing to) these error escaped me.

  10. luciole135
    Member
    Plugin Author

    Posted 2 years ago #

    i correct it on 1.4.0.1

  11. MarkvanDark
    Member
    Posted 2 years ago #

    Thank you, now its working fine.

    I set this topic to resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic