onLogin( )


Sets the method that runs when a member logs in.

onLogin() runs when a member logs into a site.

onLogin receives a currentMember object for the logged-in member, which contains the CurrentMember API methods you can use to retrieve the member's information.

Usually, you want to call onLogin() in the masterPage.js file in the code editor so that onLogin() runs no matter which page a member uses to log in.

Notes:

  • The frontend Members APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality.

  • The frontend Member APIs can only be used once the page has loaded. Therefore, you must use them in code that's contained in or is called from the onReady() or any element event.

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

handler(currentMember: CurrentMember): void Method name or expression to run when a member logs in.

Did this help?