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

Issue with the limit post views #46

Open
fransverztec opened this issue Aug 12, 2021 · 1 comment
Open

Issue with the limit post views #46

fransverztec opened this issue Aug 12, 2021 · 1 comment

Comments

@fransverztec
Copy link

What is the format/syntax of the pmpro_lpv_count cookies?

As there seems to be an issue when admin change the limit (or add membership level) and i believe the cookies on those user's PC (who was already viewing the posts in the website before the admin made a change) is not really updated?

The website posts' limit is now inconsistent.

@ideadude
Copy link
Member

ideadude commented Nov 1, 2021

Here is the code that sets the cookie string:

https://github.com/strangerstudios/pmpro-limit-post-views/blob/dev/pmpro-limit-post-views.php#L167-L173

The format is currently:
level,views,thismonth

We need to come up with something better. As @fransverztec points out, if the settings change it may become incompatible with the cookie string.

There are other issues. The current PHP implementation to redirect away when the limit is reached seems to assume the period is months, although now in the settings you can set days or hours. Expiring the cookie like we do may not always track views in the way expected.

We'd also want to support MMPU, cases where a user has more than one level. Instead of setting their views based on the first level for them, we want to use whichever level has the most views.

We should consider using JSON to encode the cookie string instead of a parsing out via commas and semicolons like this. It would be easier to get more data into the string that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants