How to count the Actual Numbers of CONFIRMED Email users?

Hello, in our “Members/PrivateMembersData” we have a field there that says “Last Login Date”. I have noticed that the default value is undefined, so when a user logs in their account for the 1st time their “Last Login Date” field will be filled with date data. Meaning if they login they already confirmed their account, right?

I set my site members to be approved by site admin and the user needs to confirm their account by clicking the confirmation email sent by wix.

By default the user clicks that link they are redirected to the home page and their account will be login automatically. So that is the only way to have their “Last Login Date” field will be filled with a value. Right? They need to login the website so that their “Last Login Date” field will have a data.
That is my basis on counting the confirmed email.

I have a 2nd Database and it is called " mymembers ", when a user register, their data will also be saved to " mymembers " database, with added new FIELDS, like status, school information and etc. By default the status value is always " INACTIVE ". This is already WORKS Perfectly together with M/PMD .
So to update " mymembers " database user’s STATUS from Inactive to ACTIVE.
Active = EMAIL Confirmed .

Below is my solution.

Is there other way to do this? Thank you

Hi, you could use onLogin to achieve the same thing:

import wixUsers from 'wix-users';

// Site code
// Code is not tested but this give you the idea
wixUsers.onLogin( (user) => {
  return wixData.get("myMembers", user.id).then(member => 
  {
    if(member && !member.active){
      member.active = true;
      
      return wixData.update("myMembers", member);
    } else {
      // member probably does not exist or exist and is 
      // already actif
    }
 })
});

hello i tried the code but can’t make it work. BUT BUT I just realized I just need to put my CODE Query to ACTIVATE Members from PAGE code to SITE CODE . This makes my code to run on every page of the website so the user’s will never missed it. Because before I have put that code inside my HomePage only. But Im not sure why some of my users’ status will never changed, maybe they never fully load when they click their confirmation link. But now since my code is on the SITE CODE panel, it will gonna run on everypage,. I hope this is a good thing xD

Is there any way to know whether an email was already confirmed even though the user did not log in?