1

I'm developing a D8 site. I am using a custom views plugin to query data from a remote api by searching a business ID.

My scenario: User is only allowed to enter 3 attempts of business ID in a search view. If 3 attempts fails, I want to hide the views UI from the page for 24 hours. What's my purpose? To give difficulty for others to guess my business ID.

This is a duplicate question with: How to use Rules to limit the number of searches to pull data from a remote API, but on another perspective.

I wasn't able to implement it using Rules, and I'm guessing if we can do it on front-end coding. Does anyone have an idea to implement this?

1 Answer 1

0

You can Set a configuration variable for each user (it's equal variables on drupal 7 ) and for each search increase it,reset it each day,But another and simple method is implement it by cookie , create a cookie for user, set expire to 24 hours, and every time user search, first check it's cookie and if not do it more that three times show results for him/her else there is nothing to him/her.I think cookie solution is good for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.