| 1 |
<?php |
| 2 |
|
| 3 |
namespace TUTOR; |
| 4 |
|
| 5 |
|
| 6 |
class User { |
| 7 |
|
| 8 |
public function __construct() { |
| 9 |
add_action('edit_user_profile', array($this, 'edit_user_profile')); |
| 10 |
add_action('show_user_profile', array($this, 'edit_user_profile'), 10, 1); |
| 11 |
|
| 12 |
add_action('profile_update', array($this, 'profile_update')); |
| 13 |
} |
| 14 |
|
| 15 |
public function edit_user_profile($user){ |
| 16 |
include tutor()->path.'views/metabox/user-profile-fields.php'; |
| 17 |
} |
| 18 |
|
| 19 |
public function profile_update($user_id){ |
| 20 |
$_tutor_profile_job_title = sanitize_text_field(tutor_utils()->avalue_dot('_tutor_profile_job_title', $_POST)); |
| 21 |
$_tutor_profile_bio = wp_kses_post(tutor_utils()->avalue_dot('_tutor_profile_bio', $_POST)); |
| 22 |
$_tutor_profile_photo = sanitize_text_field(tutor_utils()->avalue_dot('_tutor_profile_photo', $_POST)); |
| 23 |
|
| 24 |
update_user_meta($user_id, '_tutor_profile_job_title', $_tutor_profile_job_title); |
| 25 |
update_user_meta($user_id, '_tutor_profile_bio', $_tutor_profile_bio); |
| 26 |
update_user_meta($user_id, '_tutor_profile_photo', $_tutor_profile_photo); |
| 27 |
} |
| 28 |
|
| 29 |
} |