I want to give bonus points to the user if he/she logged in to the site once in a day. Is there is a way to check so that I can add the action once they logged in for the first time in a day?

  • wordpress.stackexchange.com/questions/76090/… This question pretty much answers what you want. May 23, 2018 at 13:55
  • But the link you have shared is for the newly registered user login for the first time, my question is first login in every 24 hours as per date. Like first login on 5-24-2018, then first login on 5-25-2018 and so on. So that I can add daily login bonus. May 24, 2018 at 7:35
  • You can use the code to do the same thing. Upon login, set the custom field to 1. After each day you can run a cronjob which resets everyones first_login to 0. This would mean that on each day the "first_login" will be 0 if the user hasn't logged in on that day. Then add the code to give the user the bonus inside the login hook. May 25, 2018 at 8:38
  • Yeah Perfect, Yesterday I have also done with custom DB table. In that when any user logged in then date and user id will be saved. Before that, it will check if the same date and user id exit in the table then it won't do anything else it will save the date and user id to the table and run a query for the bonus. But cron job is the better way and will implement today. Thanks. May 25, 2018 at 10:38
  • No problem. Glad I could help :) May 25, 2018 at 14:24


Your Answer

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

Browse other questions tagged or ask your own question.