PluginProbe
Tutor LMS – eLearning and online course solution / 1.2.13
Tutor LMS – eLearning and online course solution v1.2.13
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 +13 -0 1.0.31.2.13 View file →
@@ -9,8 +9,9 @@
9 9 add_action('edit_user_profile', array($this, 'edit_user_profile'));
10 10 add_action('show_user_profile', array($this, 'edit_user_profile'), 10, 1);
11 11
12 12 add_action('profile_update', array($this, 'profile_update'));
13 + add_action('set_user_role', array($this, 'set_user_role'), 10, 3);
13 14 }
14 15
15 16 public function edit_user_profile($user){
16 17 include tutor()->path.'views/metabox/user-profile-fields.php';
@@ -23,7 +24,19 @@
23 24
24 25 update_user_meta($user_id, '_tutor_profile_job_title', $_tutor_profile_job_title);
25 26 update_user_meta($user_id, '_tutor_profile_bio', $_tutor_profile_bio);
26 27 update_user_meta($user_id, '_tutor_profile_photo', $_tutor_profile_photo);
28 + }
29 +
30 + public function set_user_role($user_id, $role, $old_roles ){
31 + $instructor_role = tutor()->instructor_role;
32 +
33 + if (in_array($instructor_role, $old_roles)){
34 + tutor_utils()->remove_instructor_role($user_id);
35 + }
36 +
37 + if ($role === $instructor_role){
38 + tutor_utils()->add_instructor_role($user_id);
39 + }
27 40 }
28 41
29 42 }