• Hello,

    Could you please confirm if we have any option to figure out how many times users logged-in to their account. If not, can we find the last login made by users in their account.

    I added a separate plugin to check last login but that counts from today only. I wanted to check last 4-5 months data.

    Basically I wanted to see which users are logging-in to their account. If there is any other way to figure this out, please suggest.

    Thanks.

    • This topic was modified 2 years, 3 months ago by Vikash1989.
Viewing 4 replies - 1 through 4 (of 4 total)
  • @vikash1989

    If not, can we find the last login made by users in their account.

    Last login for the user is stored as a timestamp with the meta_key: _um_last_login

    Last login can be used for display and sorting in the UM Members Directory and as a predefined field in the UM User Profile page.

    Adding counters for number of logins you can use this action hook:

    /**
    	 * UM hook
    	 *
    	 * @type action
    	 * @title um_on_login_before_redirect
    	 * @description Hook that runs after successful login and before user is redirected
    	 * @input_vars
    	 * [{"var":"$user_id","type":"int","desc":"User ID"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage add_action( 'um_on_login_before_redirect', 'function_name', 10, 1 );
    	 * @example
    	 * <?php
    	 * add_action( 'um_on_login_before_redirect', 'my_on_login_before_redirect', 10, 1 );
    	 * function my_on_login_before_redirect( $user_id ) {
    	 *     // your code here
    	 * }
    	 * ?>
    	 */
    	do_action( 'um_on_login_before_redirect', um_user( 'ID' ) );
    • This reply was modified 2 years, 3 months ago by missveronica.
    • This reply was modified 2 years, 3 months ago by missveronica.
    • This reply was modified 2 years, 3 months ago by missveronica.

    I would like to have this function as well. Where I can add that hook? Thanks

    @cosug

    Install code snippets by adding code to your child-theme’s functions.php file
    or use the “Code Snippets” plugin.

    • This reply was modified 2 years, 3 months ago by missveronica.

    @vikash1989, @cosug

    You can try this code snippet, where you also will have additional UM Users Columns for the WP backend Users listing.

    https://github.com/MissVeronica/UM-Users-Columns

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Do we have any option to figure out the no of logins to the account?’ is closed to new replies.