| @@ -25,8 +25,9 @@ | ||
| 25 | 25 | const INSTRUCTOR = 'tutor_instructor'; |
| 26 | 26 | const ADMIN = 'administrator'; |
| 27 | 27 | |
| 28 | 28 | const REVIEW_POPUP_META = 'tutor_review_course_popup'; |
| 29 | + const LAST_LOGIN_META = 'tutor_last_login'; | |
| 29 | 30 | |
| 30 | 31 | /** |
| 31 | 32 | * Registration notice |
| 32 | 33 | * |
| @@ -61,8 +62,9 @@ | ||
| 61 | 62 | add_action( 'wp_ajax_tutor_user_photo_upload', array( $this, 'update_user_photo' ) ); |
| 62 | 63 | |
| 63 | 64 | add_action( 'admin_notices', array( $this, 'show_registration_disabled' ) ); |
| 64 | 65 | add_action( 'admin_init', array( $this, 'hide_notices' ) ); |
| 66 | + add_action( 'wp_login', array( $this, 'update_user_last_login' ), 10, 2 ); | |
| 65 | 67 | } |
| 66 | 68 | |
| 67 | 69 | /** |
| 68 | 70 | * Get meta key name for review popup. |
| @@ -375,5 +377,20 @@ | ||
| 375 | 377 | </div> |
| 376 | 378 | </div> |
| 377 | 379 | <?php |
| 378 | 380 | } |
| 381 | + | |
| 382 | + /** | |
| 383 | + * Set the user last active timestamp to now. | |
| 384 | + * | |
| 385 | + * @since 2.5.0 | |
| 386 | + * | |
| 387 | + * @param string $user_login active user name. | |
| 388 | + * @param \WP_User $user User object data. | |
| 389 | + * | |
| 390 | + * @return void | |
| 391 | + */ | |
| 392 | + public function update_user_last_login( $user_login, $user ) { | |
| 393 | + update_user_meta( $user->ID, self::LAST_LOGIN_META, time() ); | |
| 394 | + } | |
| 395 | + | |
| 379 | 396 | } |