The Loop

Where humor doesn’t work.
Dec 31, 2019 17:28
Happy New Year all! (If it's not too much to ask, pls star this while you're here so I can get the 2020 glasses hat. I tried last year and didn't get it.)
2
Jan 1, 2019 04:55
Happy new year!
 
Nov 21, 2019 15:27
Hope that helps you trace it. Good Luck!
Nov 21, 2019 15:26
The remove has to be AFTER the add, but before the process is actually used. So your action hook needs to be carefully considered to be in the right sequence of events.
Nov 21, 2019 15:25
So if you're using init to put in the remove_filter() call, but the actual add_filter() is something later, then the add comes after the remove (make sense?)
Nov 21, 2019 15:24
If the priority needs to change, it would be in the "init" (or other call). But that init may be too early. @Gregory - you need to probably trace this to see where it is added (whether than's "init" or some other action). Then use that same action to run the remove and set your priority in THAT action one number higher.
Nov 21, 2019 15:23
@giannisrig - note that the remove_filter() has to have the same priority as the original add (which in this case appears to be the default 10).
 
Apr 8, 2019 20:33
Yes - as written it will remove anything 8 days old. Modify as needed.
Apr 8, 2019 20:33
I added some info on how you can clean up data as you go.
Apr 8, 2019 20:33
I think the problem with the last code snippet was the > and < comparisons were reversed from what they should have been. I made that change and it seems that both display calculations work at this point (tested the whole thing here locally). Keep in mind it's not a perfect solution. Adjust as needed. One additional note is the last code snippet is a replacement of the center section of the display code snippet - you're just swapping out that piece.
Apr 8, 2019 20:33
There were a couple of stupid mistakes (probably as I carried over some changes in the way I approached it initially). First, I had originally displayed as count( $display_value ), and then I changed to making $display_value a number but was still using count(). So I fixed that to just display the integer. The other problem was that in the logic comparing the time, the $timestamp value is already a UNIX timestamp so it doesn't need strtotime(). Fixing those in the original displays the expected value (2). I made a similar fix to the second logic set as well. See above.
Apr 8, 2019 20:33
As written, it will "collect" every visit (including multiple visits by IP) so you have a total "raw" set of data. Then you can handle displaying it in any way that you want. So you wouldn't change the collection process for that. Instead, you'd change the section where it calculates the value to display (I updated the code snippet with comments marking the beginning and end of that).