How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout


I am working on a wordpress site and i am little stuck into one situation , what i want is that:_

  1. I have one resume page, which shows resume posts from wp_postmeta table and each post have a downlaod link button so that users can download that specific post in form of pdf
  2. Now the tricky part:- each user can download each post only for 5 times that means one post can be downloaded only 5 times, after 5 times click on download button, the download button disappears(everything working fine till now )
  3. what i want now is that saving the clicks of download button; for example:- i have 5 clicks of a download link button of a specific resume post, i used 2 clicks now when i refresh the page i want the remaining 3 clicks not all 5 clicks, on page reload or login/logout of a specific user.**
    Here below is the screenshot of my resume page

View Image

here below is the js i am using for hiding the buttons after 5 clicks.

                     $(".gotocls").click(function() {
                         count= $(this).attr("data-click");
                         count ++;
                        $(this).attr('data-click', count);
            <a data-click="0" class="dkpdf-button gotocls" href="">Downlaod Resume</a>
, , , , Almight Hacker 1 year 2020-09-03T03:10:19-05:00 0 Answers 68 views 0

Leave an answer