Some posts have Total Views stuck at zero 0
-
I’ve noticed that Top 10 tracks most of my posts well, but a few have a count that seems to be stuck at 0, and cannot be updated.
If I go to the Posts page of the dashboard for the site, Total Views shows as 0, and Today’s Views may be a nonzero number. However, the Total Views number never changes.
If I open the particular post for editing, the Top 10 Section at the bottom shows the following (sorry, I don’t know how to include a picture):
Visit Count: 0
Disable Popular Posts Display: (unchecked)
Exclude this post from the popular posts list: (unchecked)
Location of thumbnail: (blank)In the above, I have tried to update the Visit Count to some other number such as 20, but after I update the post, the 0 is back. I have also tried checking the boxes, updating, unchecking the boxes, and updating again. The Visit Count is still stuck at 0, and uneditable.
Actual visits to the page update the daily count, but the total views count is stuck at 0.
Only some of my posts have this issue. One example is in the link above.
One thing that the problem posts MAY have in common is that the post date was edited after the fact. I’m not absolutely sure of this, but it seems to affect something that was posted on (say) April 23, then later altered to show a date of April 22.
Any ideas or suggestions? Thanks in advance!
The page I need help with: [log in to see the link]
-
I have a feeling there might be a problem the overall database that is causing this issue. Can you please check the structure of the wp_top_ten table by logging into phpMyAdmin and post it here.
I’m a novice at this forum, and don’t know how to attach a file or picture, so have just exported the contents of the wp_top_ten table to a text file, and will paste it here:
== Table structure for table wp_top_ten |------ |Column|Type|Null|Default |------ |//**postnumber**//|bigint(20)|No|0 |cntaccess|bigint(20)|Yes|NULL |blog_id|bigint(20)|No|1 == Dumping data for table wp_top_ten |1|171|4 |2|13101|1 |5|707|9 |7|3|10 |8|64|10 |9|214|5 |10|2677|9 |12|2069|9 |14|27|4 |15|610|9 |19|15|10 |20|359|9 |24|59|5 |29|1241|9 |31|23|3 |32|32|4 |33|86|5 |39|1|10 |40|1|10 |45|122|5 |47|162|9 |53|68|10 |58|90|10 |62|115|4 |67|52|3 |69|210|5 |80|41|3 |81|223|5 |83|29|4 |84|44|10 |98|11|10 |106|31|4 |110|62|5 |113|106|3 |119|44|4 |121|14|10 |124|28|4 |125|2|4 |126|3|4 |127|22|4 |128|5|4 |129|5|4 |130|5|4 |131|46|4 |132|17|4 |133|49|4 |134|4|4 |135|7|4 |136|7|4 |137|4|4 |138|4|4 |139|7|4 |140|3|4 |141|53|3 |142|26|4 |145|22|10 |153|169|5 |154|150|4 |156|50|5 |158|80|3 |161|24|10 |166|92|5 |174|1354|4 |177|124|5 |191|49|3 |192|330|4 |194|19|10 |195|91|5 |202|3|4 |213|260|3 |214|179|5 |216|15|10 |233|19|3 |238|46|5 |242|71|10 |245|14|10 |257|13|10 |260|2613|5 |272|14|10 |280|34|10 |286|251|5 |291|341|5 |294|29|10 |298|393|5 |308|33|10 |326|49|3 |333|324|5 |340|75|3 |344|249|5 |345|53|3 |350|41|10 |353|169|5 |356|44|3 |360|83|5 |363|48|3 |366|3|5 |368|120|5 |370|50|3 |373|170|3 |387|183|5 |390|42|3 |391|63|10 |396|80|10 |398|3|5 |403|61|3 |404|1|5 |412|90|10 |413|11|5 |416|11|5 |418|630|5 |425|57|3 |427|126|5 |432|115|5 |433|59|3 |440|113|3 |441|87|10 |442|15|5 |443|479|5 |446|84|3 |450|117|5 |455|211|10 |458|71|10 |459|111|5 |472|40|3 |474|1|5 |475|96|5 |477|1|5 |479|1|5 |481|1|5 |482|39|3 |484|1|5 |486|95|5 |490|11|10 |491|124|3 |492|110|10 |505|107|5 |507|119|5 |523|72|3 |530|152|3 |542|1|5 |543|1|5 |544|357|5 |550|75|10 |553|96|10 |554|59|3 |559|7|5 |561|152|5 |575|71|10 |586|28|3 |587|10|10 |588|12|10 |589|10|10 |591|2|10 |592|12|10 |593|14|10 |597|91|10 |605|32|10 |606|5|10 |607|11|10 |608|88|10 |610|89|3 |612|86|5 |620|22|5 |625|8|10 |626|51|10 |632|37|10 |636|97|3 |637|20|10 |638|87|10 |641|8|10 |652|90|10 |666|95|3 |670|4|10 |671|4|10 |672|83|10 |691|62|3 |694|4|10 |695|23|10 |696|7|10 |697|129|10 |706|215|3 |728|6|10 |729|78|10 |745|69|10 |751|3|10 |752|3|10 |753|3|10 |757|73|3 |767|8|10 |768|43|10 |770|94|10 |780|55|3 |784|1|10 |786|1|10 |790|4|10 |791|4|10 |792|4|10 |793|72|10 |803|60|3 |812|6|10 |814|6|10 |815|14|3 |835|112|10 |843|67|3 |848|18|10 |850|18|10 |851|88|10 |875|18|10 |876|12|10 |877|118|10 |891|2|10 |892|2|10 |893|46|10 |894|123|10 |903|9|10 |905|1|10 |906|35|3 |907|97|10 |911|19|10 |930|9|10 |931|9|10 |932|9|10 |933|22|10 |935|78|10 |949|5|10 |950|67|3 |951|82|10 |953|51|3 |967|123|10 |971|48|3 |988|2|10 |989|2|10 |990|2|10 |991|16|10 |992|59|10 |994|79|10 |1000|97|3 |1020|94|10 |1024|1|10 |1025|1|10 |1026|65|10 |1037|143|3 |1045|5|10 |1046|5|10 |1064|84|10 |1067|91|3 |1070|7|10 |1071|79|10 |1077|73|3 |1090|64|10 |1092|3|10 |1093|85|10 |1107|196|3 |1114|3|10 |1115|3|10 |1118|41|10 |1119|73|10 |1123|25|10 |1137|8|10 |1138|9|10 |1139|9|10 |1140|65|10 |1147|65|3 |1162|84|10 |1167|105|3 |1175|43|10 |1176|74|10 |1193|8|10 |1194|8|10 |1195|272|3 |1215|19|10 |1216|100|10 |1227|55|3 |1235|22|10 |1237|22|10 |1238|65|10 |1254|34|10 |1256|6|10 |1257|76|10 |1275|530|3 |1281|2|3 |1302|88|10 |1320|10|10 |1321|10|10 |1322|22|10 |1323|118|10 |1341|29|10 |1343|10|10 |1353|73|10 |1356|1|10 |1357|56|10 |1371|9|3 |1377|10|10 |1379|63|10 |1392|88|10 |1406|2|10 |1407|88|10 |1421|81|10 |1441|5|10 |1443|5|10 |1445|70|10 |1453|20|10 |1455|5|10 |1456|5|10 |1457|64|10 |1458|506|3 |1467|5|10 |1469|12|10 |1470|60|10 |1484|20|3 |1485|42|3 |1487|31|3 |1488|31|3 |1489|6|3 |1490|75|10 |1509|57|10 |1518|177|1 |1519|18|1 |1524|53|10 |1526|16|10 |1527|79|10 |1529|10|1 |1531|13|1 |1535|4840|1 |1537|217|1 |1538|22|1 |1542|22|1 |1544|20|1 |1545|14|1 |1550|75|10 |1557|21|1 |1558|29|1 |1561|29|1 |1569|8|10 |1570|10|10 |1571|69|10 |1582|1|10 |1583|68|10 |1584|13|1 |1585|124|10 |1589|12|1 |1590|12|1 |1591|10|1 |1592|9|1 |1593|11|1 |1594|11|1 |1595|11|1 |1597|16|1 |1598|15|1 |1603|70|10 |1609|22|1 |1611|859|1 |1614|34|1 |1616|19|1 |1617|38|1 |1618|18|1 |1619|16|1 |1620|11|1 |1621|11|1 |1622|5|1 |1623|75|1 |1624|8|1 |1625|10|1 |1634|94|1 |1639|26|10 |1641|55|10 |1642|5|1 |1643|4|10 |1644|37|1 |1646|59|10 |1647|68|10 |1649|1962|1 |1653|175|1 |1654|77|1 |1655|1|1 |1658|632|1 |1666|6453|1 |1667|33|1 |1668|49|1 |1680|1144|1 |1686|20|1 |1687|17|1 |1688|13|1 |1689|14|1 |1690|19|1 |1696|65|10 |1701|1639|1 |1703|4|10 |1705|99|1 |1706|37|1 |1717|4|10 |1724|4|10 |1725|5|10 |1727|72|10 |1731|1092|1 |1737|7|10 |1738|7|10 |1739|60|10 |1755|1|10 |1756|57|10 |1758|191|1 |1768|244|1 |1774|9|10 |1775|52|10 |1782|1147|1 |1794|3|10 |1795|8|10 |1799|8|10 |1800|65|10 |1811|4|10 |1812|4|10 |1813|54|10 |1824|692|1 |1832|8|10 |1833|56|10 |1845|17673|1 |1850|5|10 |1851|63|10 |1869|6|10 |1870|12|10 |1871|71|10 |1882|2219|1 |1886|113|10 |1895|484|1 |1903|1|1 |1909|26|10 |1910|7|10 |1912|7|10 |1914|12|10 |1915|93|10 |1923|1152|1 |1935|6|10 |1936|21|10 |1937|77|10 |1944|12|10 |1945|84|10 |1952|9|10 |1953|88|10 |1959|1|10 |1961|28|10 |1962|47|10 |1963|34|10 |1964|34|10 |1965|18|10 |1968|7|10 |1969|433|1 |1970|69|10 |1972|51|10 |1973|55|10 |1974|54|10 |1976|28|10 |1977|28|10 |1978|54|10 |1980|29|10 |1981|210|1 |1983|47|10 |1984|30|10 |1985|10|10 |1986|11|10 |1989|9|10 |1991|10|10 |1993|7|10 |1994|8|10 |1996|22|10 |1997|39|10 |1998|58|10 |1999|87|10 |2000|74|10 |2001|33|10 |2002|88|10 |2003|71|10 |2004|33|10 |2005|47|10 |2006|33|10 |2007|73|10 |2008|54|10 |2009|33|10 |2010|33|10 |2012|34|10 |2013|44|10 |2014|45|10 |2015|76|1 |2016|62|10 |2017|55|10 |2018|62|10 |2019|88|10 |2020|10|10 |2021|12|10 |2022|12|10 |2023|89|10 |2024|72|10 |2025|89|10 |2028|66|10 |2031|47|10 |2032|120|10 |2033|30|10 |2034|69|10 |2035|122|10 |2036|53|10 |2037|61|10 |2039|56|10 |2040|88|10 |2041|80|10 |2042|66|10 |2043|83|10 |2045|88|10 |2048|66|10 |2050|104|10 |2051|86|1 |2052|27|10 |2053|28|10 |2055|97|10 |2057|54|10 |2059|100|10 |2077|212|1 |2089|578|1 |2114|5889|1 |2128|191|1 |2137|195|1 |2150|1990|1 |744|2|3 |2197|6059|1 |2198|348|1 |2231|89|1 |2232|89|1 |2233|89|1 |2235|282|1 |2258|149|1 |2269|1|1 |2273|14|1 |2277|562|1 |2288|81|1 |2303|772|1 |2318|62|1 |2319|62|1 |2320|2050|1 |2327|58|1 |2330|145|1 |2331|318|1 |2332|932|1 |2333|274|1 |2334|132|1 |2358|123|1 |2362|123|1 |2365|1082|1 |2369|334|1 |2400|22|1 |2408|10|1 |2412|1445|1 |2438|1|1 |2443|14537|1 |2444|135|1 |2456|14733|1 |2463|26|1 |2481|169|1 |2482|60|1 |2483|45|1 |2484|93|1 |2486|5|1 |2488|3154|1 |2514|8|1 |2527|8|1 |2551|4|1 |2559|3|1
One of the afflicted posts, “Austin, TX” is ID 1275 https://pididu.com/wordpress/bike2017/?p=1275
That is blog 10 (this is a multisite installation).I noticed that there is an ID 1275 in the wp_top_ten table, but that’s for blog 3. https://pididu.com/wordpress/bike2010/?p=1275
If that’s any help. Thanks for looking into this.
I have a feeling, a thorough reinstall might be needed.
Can you please do this:
1. Backup your entire site database. And, also separately export wp_top_ten and wp_top_ten_daily. This is critical.2. In the settings page, select “Delete options…” and “Delete counter data” and save options
https://ps.w.org/top-10/assets/screenshot-1.png?rev=1770116
3. Deactivate the plugin from the Plugins page and then uninstall/delete it from there. This should delete both the tables from the database
4. Reinstall the plugin and test that if you browse the sites, then the counter works. Am hoping at this stage it works.
5. At this stage, you can import the tables content back again (not structure)
I’ll give it a try, thanks.
Okay, I tried it. Now the blog 10 post number 1275 works, but the blog 3 post 1275 does not. After deleting options and data, then reinstalling, the tables got tiny. Here they are:
== Table structure for table wp_top_ten_daily |------ |Column|Type|Null|Default |------ |//**postnumber**//|bigint(20)|No|0 |cntaccess|bigint(20)|Yes|NULL |//**dp_date**//|datetime|No|0000-00-00 00:00:00 |blog_id|bigint(20)|No|1 == Dumping data for table wp_top_ten_daily |455|1|2017-11-25 14:00:00|10 |1275|4|2017-11-25 14:00:00|10 |1458|2|2017-11-25 22:00:00|3 |1275|3|2017-11-25 22:00:00|3 |2114|1|2017-11-25 14:00:00|1 |387|2|2017-11-25 14:00:00|5 |620|1|2017-11-25 14:00:00|5 |1227|1|2017-11-25 22:00:00|3
and
== Table structure for table wp_top_ten |------ |Column|Type|Null|Default |------ |//**postnumber**//|bigint(20)|No|0 |cntaccess|bigint(20)|Yes|NULL |blog_id|bigint(20)|No|1 == Dumping data for table wp_top_ten |455|1|10 |1275|7|10 |1458|2|3 |1496|6|3 |2114|1|1 |387|2|5 |620|1|5 |1227|1|3
It seems there is a daily visit to blog 10, post 1275, and also a visit to blog 3, post 1275. But also, it looks like both are recorded under the table entry for blog 10, post 1275, and there is never an entry created for the blog 3 post. Are you sure that your plugin checks that both the post number and blog ID match when updating counts? Looks like if the post number matches, the blog ID is ignored?
It does check: https://github.com/WebberZone/top-10/blob/master/includes/tracker.php#L145
Looking at the last column, is the blog ID. Is that all the data you have for 1275? The reason I ask is, do you have any data for 1275 that dates back to 16th? Or even 15th for another hour?
The visits in the daily table are recorded on an hourly basis only while those in the main table are just the absolute counts over time.
Can you please try one thing: Changing the tracker type to Query Variable from Ajax based under the Counter/Tracker tab?
Or vice versa to Ajax based from Query variable based
-
This reply was modified 7 years, 3 months ago by
Ajay.
I think I understand your paradigm of transferring counts to the totals once a day, but it seems quite a coincidence that in the newly-installed plugin of the previous post (reply 6 above), there are 3 accesses to 1275 in one blog in the daily, and 4 accesses in the other blog in the daily, and the total count seems to be 7. As if the counts were instantaneously transferred. Also, if I edit post 1275 of blog 3, and at the bottom in the Top 10 section, change the count of 0 to 5, then Update the post, the count is not saved.
Also, in reply 3 above, which reflects Top 10 that has been active for years, there are no rows with the same post number, but different blog ID. I’m assuming that if several different blogs have (say) post 123, then there will be a row for post 123, blog 1; and another for post 123, blog 2; and yet another for post 123, blog 3?
Here are the tables as they were captured today. Possibly that has been enough time to update the main tables, possibly not, but it does seem that there has been a change to the count for post number 1275, blog ID 10. But there is still no entry for post 1275, blog 3. Very strange.
== Table structure for table wp_top_ten_daily |------ |Column|Type|Null|Default |------ |//**postnumber**//|bigint(20)|No|0 |cntaccess|bigint(20)|Yes|NULL |//**dp_date**//|datetime|No|0000-00-00 00:00:00 |blog_id|bigint(20)|No|1 == Dumping data for table wp_top_ten_daily |455|1|2017-11-25 14:00:00|10 |1275|4|2017-11-25 14:00:00|10 |1458|2|2017-11-25 22:00:00|3 |1275|3|2017-11-25 22:00:00|3 |2114|1|2017-11-25 14:00:00|1 |387|2|2017-11-25 14:00:00|5 |620|1|2017-11-25 14:00:00|5 |1227|1|2017-11-25 22:00:00|3 |2|5|2017-11-25 15:00:00|9 |1680|1|2017-11-25 15:00:00|1 |1275|9|2017-11-25 23:00:00|3 |2114|1|2017-11-25 15:00:00|1 |12|1|2017-11-25 15:00:00|9 |10|1|2017-11-25 15:00:00|9 |15|1|2017-11-25 15:00:00|9 |2114|4|2017-11-25 16:00:00|1 |260|1|2017-11-25 16:00:00|5 |12|2|2017-11-25 16:00:00|9 |29|2|2017-11-25 16:00:00|9 |286|1|2017-11-25 16:00:00|5 |2|1|2017-11-25 16:00:00|9 |10|1|2017-11-25 16:00:00|9 |5|1|2017-11-25 16:00:00|9 |15|1|2017-11-25 16:00:00|9 |455|11|2017-11-25 16:00:00|10 |1585|1|2017-11-25 16:00:00|10 |1020|1|2017-11-25 16:00:00|10 |530|1|2017-11-25 16:00:00|10 |98|1|2017-11-25 16:00:00|10 |967|1|2017-11-25 16:00:00|10 |396|1|2017-11-25 16:00:00|10 |2320|1|2017-11-25 16:00:00|1 |192|1|2017-11-25 16:00:00|10 |1571|1|2017-11-25 16:00:00|10 |1727|1|2017-11-25 16:00:00|10 |1445|1|2017-11-25 16:00:00|10 |1851|1|2017-11-25 16:00:00|10 |53|1|2017-11-25 16:00:00|10 |1458|1|2017-11-26 00:00:00|3 |706|1|2017-11-26 00:00:00|3 |744|3|2017-11-26 00:00:00|3 |757|3|2017-11-26 00:00:00|3 |780|2|2017-11-26 00:00:00|3 |1895|1|2017-11-25 16:00:00|1 |1981|1|2017-11-25 17:00:00|1 |1895|2|2017-11-25 17:00:00|1 |2551|1|2017-11-25 17:00:00|1 |1845|3|2017-11-25 17:00:00|1 |2|5|2017-11-25 17:00:00|9 |231|1|2017-11-25 17:00:00|8 |105|2|2017-11-25 17:00:00|8 |174|2|2017-11-25 17:00:00|4 |154|1|2017-11-25 17:00:00|4 |10|2|2017-11-25 17:00:00|9 |192|2|2017-11-25 17:00:00|9 |15|1|2017-11-25 17:00:00|9 |260|2|2017-11-25 17:00:00|5 |2128|1|2017-11-25 17:00:00|1 |1680|1|2017-11-25 18:00:00|1 |260|1|2017-11-25 18:00:00|5 |610|1|2017-11-26 03:00:00|3 |1666|3|2017-11-25 20:00:00|1 |1701|3|2017-11-25 20:00:00|1 |1680|2|2017-11-25 20:00:00|1 |1845|1|2017-11-25 20:00:00|1 |1535|1|2017-11-25 21:00:00|1 |544|1|2017-11-25 21:00:00|5 |2114|1|2017-11-25 21:00:00|1 |2|3|2017-11-25 21:00:00|9 |1882|1|2017-11-25 21:00:00|1 |2320|1|2017-11-25 21:00:00|1 |29|2|2017-11-25 22:00:00|9 |418|1|2017-11-25 22:00:00|5 |2|2|2017-11-25 22:00:00|9 |1845|1|2017-11-25 23:00:00|1 |2|7|2017-11-26 07:00:00|3 |2114|1|2017-11-25 23:00:00|1 |2|2|2017-11-25 23:00:00|9 |2051|1|2017-11-26 00:00:00|1 |373|1|2017-11-26 08:00:00|3 |1535|1|2017-11-26 00:00:00|1 |1275|2|2017-11-26 01:00:00|10 |1275|3|2017-11-26 09:00:00|3 |2|1|2017-11-26 01:00:00|9 |1882|1|2017-11-26 01:00:00|1 |2|3|2017-11-26 02:00:00|9 |523|1|2017-11-26 10:00:00|3 |1666|2|2017-11-26 02:00:00|1 |443|1|2017-11-26 02:00:00|5 |1000|1|2017-11-26 10:00:00|3 |1923|3|2017-11-26 02:00:00|1 |2150|1|2017-11-26 03:00:00|1 |1392|1|2017-11-26 03:00:00|10 |67|1|2017-11-26 11:00:00|3 |260|1|2017-11-26 03:00:00|5 |2|2|2017-11-26 03:00:00|9 |1845|1|2017-11-26 03:00:00|1 |1107|1|2017-11-26 11:00:00|3 |2|3|2017-11-26 04:00:00|9 |2559|1|2017-11-26 04:00:00|1 |757|1|2017-11-26 12:00:00|3 |652|1|2017-11-26 04:00:00|10 |47|1|2017-11-26 04:00:00|9 |803|1|2017-11-26 12:00:00|3 |2559|1|2017-11-26 05:00:00|1 |2114|1|2017-11-26 05:00:00|1 |1845|2|2017-11-26 05:00:00|1 |2|6|2017-11-26 05:00:00|9 |1680|2|2017-11-26 05:00:00|1 |29|1|2017-11-26 05:00:00|9 |10|1|2017-11-26 05:00:00|9 |1509|1|2017-11-26 05:00:00|10 |2|9|2017-11-26 06:00:00|9 |2150|1|2017-11-26 06:00:00|1 |2114|1|2017-11-26 06:00:00|1 |12|1|2017-11-26 06:00:00|9 |29|1|2017-11-26 06:00:00|9 |10|4|2017-11-26 06:00:00|9 |5|1|2017-11-26 06:00:00|9 |492|1|2017-11-26 06:00:00|10 |1592|1|2017-11-26 06:00:00|1 |142|1|2017-11-26 06:00:00|10 |10|1|2017-11-26 07:00:00|9 |5|2|2017-11-26 07:00:00|9 |20|1|2017-11-26 07:00:00|9 |1|1|2017-11-26 07:00:00|9 |29|2|2017-11-26 07:00:00|9 |12|1|2017-11-26 07:00:00|9 |697|1|2017-11-26 07:00:00|10 |1067|1|2017-11-26 15:00:00|3 |2|4|2017-11-26 08:00:00|9 |2412|1|2017-11-26 08:00:00|1 |1758|1|2017-11-26 08:00:00|1 |10|1|2017-11-26 08:00:00|9 |12|1|2017-11-26 08:00:00|9 |29|1|2017-11-26 08:00:00|9 |2|6|2017-11-26 09:00:00|9 |10|2|2017-11-26 09:00:00|9 |12|2|2017-11-26 09:00:00|9 |80|1|2017-11-26 17:00:00|3 |29|2|2017-11-26 09:00:00|9 |425|1|2017-11-26 17:00:00|3 |5|1|2017-11-26 09:00:00|9 |1965|1|2017-11-26 09:00:00|10 |1535|1|2017-11-26 10:00:00|1 |2|1|2017-11-26 10:00:00|9 |1666|1|2017-11-26 10:00:00|1
== Table structure for table wp_top_ten |------ |Column|Type|Null|Default |------ |//**postnumber**//|bigint(20)|No|0 |cntaccess|bigint(20)|Yes|NULL |blog_id|bigint(20)|No|1 == Dumping data for table wp_top_ten |455|12|10 |1275|21|10 |1458|3|3 |1496|6|3 |2114|10|1 |387|2|5 |620|1|5 |1227|1|3 |2|60|9 |1680|6|1 |12|8|9 |10|13|9 |15|3|9 |260|5|5 |29|11|9 |286|1|5 |5|5|9 |1585|1|10 |1020|1|10 |530|1|10 |98|1|10 |967|1|10 |396|1|10 |2320|2|1 |192|3|10 |1571|1|10 |1727|1|10 |1445|1|10 |1851|1|10 |53|1|10 |706|1|3 |744|3|3 |757|4|3 |780|2|3 |1895|3|1 |1981|1|1 |2551|1|1 |1845|8|1 |231|1|8 |105|2|8 |174|2|4 |154|1|4 |2128|1|1 |610|1|3 |1666|6|1 |1701|3|1 |1535|3|1 |544|1|5 |1882|2|1 |418|1|5 |2051|1|1 |373|1|3 |523|1|3 |443|1|5 |1000|1|3 |1923|3|1 |2150|2|1 |1392|1|10 |67|1|3 |1107|1|3 |2559|2|1 |652|1|10 |47|1|9 |803|1|3 |1509|1|10 |492|1|10 |1592|1|1 |142|1|10 |20|1|9 |1|1|9 |697|1|10 |1067|1|3 |2412|1|1 |1758|1|1 |80|1|3 |425|1|3 |1965|1|10
I will try the Ajax/Non experiment, and report what happened. Thanks again for your help!
Thanks. This is indeed very strange. On page load, the plugin updates both tables at the same time. This issue with 1275 seems rather strange.
The URL above that I visited is passing the blog ids correctly or so it seems. You can see this when viewing the source of the page.
I’ve retested on my own site which runs multisite and the blog counts update properly.
I changed to Ajax from Query Variable, and the issue persists.
I ran another experiment, which may give some insight. What I did was edit the post 1275 on blog 3, and set the Total Views to 99 in the UI. Then update. What I find is that the top_ten row for post 1275, blog ID 10, is updated to 99. This suggests to me that in https://github.com/WebberZone/top-10/blob/master/includes/tracker.php#L145 that you showed me, the ON DUPLICATE KEY is being taken. Are both postnumber and blog_id primary keys? It could be that when you try to do the insert, if only postnumber is a key, that it sees a 1275, and declares that this is a DUPLICATE KEY, without checking any other fields. Certainly, cntaccess does not need to be a key, but I would think that blog_id needs to be?
I have noticed that everything works fine as long as the same postnumber does not appear on two different blogs. Things are tracked properly. Since you’re running multisite, have you tried publishing posts with exactly the same postnumber on two separate blogs? Might take a bit of doing, and you might have to start two brand new blogs to get a low number like ID 1, 2, 3, etc.
I found a way to patch it, but that’s because I have direct access to the database. This is just one way to fix the problem, but I think it can be adapted to your plugin. I got into MariaDB (MySQL), and did:
MariaDB [(none)]> use MyWordPressDatabase; MariaDB [MyWordPressDatabase]> alter table wp_top_ten -> drop primary key; Query OK, 108 rows affected (0.06 sec) Records: 108 Duplicates: 0 Warnings: 0 MariaDB [MyWordPressDatabase]> alter table wp_top_ten -> add primary key(postnumber, blog_id); Query OK, 108 rows affected (0.01 sec) Records: 108 Duplicates: 0 Warnings: 0 MariaDB [MyWordPressDatabase]> quit Bye
After a few hits to post 1275 in both blogs, the wp_top_ten table looks like the below. Note that the 2nd row in the table is postnumber 1275, but also the last row (with a different blog_id):
== Table structure for table wp_top_ten |------ |Column|Type|Null|Default |------ |//**postnumber**//|bigint(20)|No|0 |cntaccess|bigint(20)|Yes|NULL |//**blog_id**//|bigint(20)|No|1 == Dumping data for table wp_top_ten |455|13|10 |1275|100|10 |1458|8|3 |1496|6|3 |2114|20|1 |387|2|5 |620|1|5 |1227|2|3 |2|145|9 |1680|17|1 |12|18|9 |10|32|9 |15|9|9 |260|6|5 |29|22|9 |286|1|5 |5|9|9 |1585|1|10 |1020|1|10 |530|2|10 |98|1|10 |967|1|10 |396|1|10 |2320|6|1 |192|5|10 |1571|1|10 |1727|1|10 |1445|1|10 |1851|1|10 |53|1|10 |706|1|3 |744|3|3 |757|4|3 |780|2|3 |1895|3|1 |1981|2|1 |2551|1|1 |1845|15|1 |231|1|8 |105|2|8 |174|5|4 |154|1|4 |2128|1|1 |610|1|3 |1666|22|1 |1701|5|1 |1535|4|1 |544|1|5 |1882|3|1 |418|6|5 |2051|1|1 |373|1|3 |523|2|3 |443|2|5 |1000|1|3 |1923|4|1 |2150|4|1 |1392|1|10 |67|1|3 |1107|1|3 |2559|4|1 |652|2|10 |47|2|9 |803|1|3 |1509|1|10 |492|2|10 |1592|1|1 |142|1|10 |20|5|9 |1|1|9 |697|2|10 |1067|1|3 |2412|10|1 |1758|1|1 |80|3|3 |425|1|3 |1965|1|10 |1649|4|1 |793|1|10 |1658|7|1 |2400|1|1 |1653|1|1 |491|3|10 |507|1|5 |550|1|10 |553|1|10 |575|1|10 |597|1|10 |605|1|10 |608|1|10 |626|1|10 |638|1|10 |672|1|10 |2303|2|1 |233|2|3 |1667|1|1 |119|1|4 |2484|1|1 |333|1|5 |360|1|3 |340|1|3 |213|1|3 |1589|1|1 |504|2|3 |482|1|3 |326|1|3 |2444|2|1 |433|1|3 |1275|123|3
I’ve filed an issue in the Github repo and I will fix this in the next version.
The current version has the correct primary key: https://github.com/WebberZone/top-10/blob/master/includes/activate-deactivate.php#L64
But, I have a feeling that you’re a long time user of Top 10 and the database you have in there had an outdated structure. I’m going to do a bit more digging to figure out how I can upgrade old time users.
Indeed, I am a long-time user, starting from 2010.
I noticed in that github link above, that besides the top_ten using two fields for primary key, the schema for the top_ten_daily uses all three fields for the primary key. I note that my database only uses the first two. Probably I should fix mine up, too.
Somehow, I thought that when I deleted the plugin then installed it again, it would drop all the old tables, not just blank them out. That would be one way to insure that the install was clean, with the right schema. Or at least have a checkbox for that, similar to Delete Options on Uninstall. In fact, I think this is the approach I will take to fixing my database – I’ll uninstall Top10, then go in and manually drop to top_ten and top_ten_daily tables, then reinstall.
Another way might be to basically do a sequence of commands like I had in the post above – drop the primary key from the table in the existing database, and add it again with the proper configuration. That could happen on every upgrade without harm, and it would fix old users on the next upgrade cycle.
I uninstalled Top10, manually DROPped the top_ten and top_ten_daily tables, then installed Top10 2.5.4 . Everything works now. I had archived the table data previously as you suggested, so could restore it (after deleting the lines in the .sql file generating the structure) at this point if I wanted to.
Thanks for your help! And for your wonderful plugin over the years. I’m marking this thread as resolved.
Make daily count more accuracy which Tracker type is important?
1. Query variable based: Uses query variables to record visits
OR
2. Ajaxurl based: Uses admin-ajax.php which is inbuilt within WordPress to process the trackerThanks
-
This reply was modified 7 years, 3 months ago by
- The topic ‘Some posts have Total Views stuck at zero 0’ is closed to new replies.