Making WordPress.org

Changeset 11329


Ignore:
Timestamp:
11/17/2021 05:46:56 AM (3 years ago)
Author:
dd32
Message:

Login: Record the last login date.

See #5618.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/wporg-sso/wp-plugin.php

    r11327 r11329  
    7474
    7575                add_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
     76
     77                add_action( 'wp_login', array( $this, 'record_last_logged_in' ), 10, 2 );
    7678
    7779                if ( ! $this->is_sso_host() ) {
     
    610612        }
    611613
     614        /**
     615         * Record the last date a user logged in.
     616         *
     617         * Note: This might be before they agree to the new TOS, which is recorded separately.
     618         */
     619        public function record_last_logged_in( $login, $user ) {
     620            update_user_meta( $user->ID, 'last_logged_in', gmdate( 'Y-m-d H:i:s' ) );
     621        }
     622
    612623    }
    613624
Note: See TracChangeset for help on using the changeset viewer.