PluginProbe
Tutor LMS – eLearning and online course solution / 2.5.0
Tutor LMS – eLearning and online course solution v2.5.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | classes/User.php +17 -0 2.4.02.5.0 View file →
@@ -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 }