Custom Field on Registration

If you want to add a new field on the registration page for Tutor LMS, please follow the snippet below.

In this sample, we have added a new field for phone number. Following this sample method, you can add as many custom fields as you want.

PHP Snippet

This one handles the functionality part. You have to paste this code on your child theme’s functions.php file. You can use a custom plugin if you want as well.

add_filter('tutor_student_registration_required_fields', 'required_phone_no_callback');
if ( ! function_exists('required_phone_no_callback')){
    function required_phone_no_callback($atts){
        $atts['phone_no'] = 'Phone Number field is required';
        return $atts;
add_action('user_register', 'add_phone_after_user_register');
add_action('profile_update', 'add_phone_after_user_register');
if ( ! function_exists('add_phone_after_user_register')) {
    function add_phone_after_user_register($user_id){
        if ( ! empty($_POST['phone_no'])) {
            $phone_number = sanitize_text_field($_POST['phone_no']);
            update_user_meta($user_id, '_phone_number', $phone_number);

HTML Snippet

This snippet will add the new field in HTML

   <div class="tutor-form-row">

        <div class="tutor-form-col-12">
            <div class="tutor-form-group">
                    <?php _e('Phone Number', 'tutor'); ?>

                <input type="text" name="phone_no" value="<?php echo tutor_utils()->input_old('phone_no'); ?>" placeholder="<?php _e('Phone Number', 'tutor'); ?>">


The HTML code should go in the registration.php file and you should override it from your theme. The location of the file would be- yourtheme/tutor/dashboard/registration.php

Here is a gist showing the entire file with the extra code in it. The Phone number field code is placed between line number 73 to 85.

Update from Profile Settings – Frontend

The data on profile settings is fetched through /tutor/templates/dashboard/settings/profile.php. So, you have to override this file from your theme as well. The code should be something like-

        <div class="tutor-form-row">
            <div class="tutor-form-col-4">
                <div class="tutor-form-group">
                        <?php _e('Document Number', 'tutor'); ?>
                    <input type="text" name="doc_number" value="<?php echo get_user_meta($user->ID, '_doc_number', true); ?>" placeholder="<?php _e('Document Number', 'tutor'); ?>">

See the new fields in the backend

The backend profile data is being served from the file located at /tutor/views/metabox/user-profile-fields.php. So, you can edit this file like-

<tr class="user-description-wrap">
		<th><label for="description"><?php _e('Document Number'); ?></label></th>
			<input type="text" name="doc_number" id="doc_number" value="<?php echo get_user_meta($user->ID, '_doc_number', true); ?>" class="regular-text" />
This change would be lost on the Tutor LMS update. We will implement a better way to override this file very soon. As an alternative, you can use the “User Meta Inspector” plugin to see the data from the backend.

Display Custom Form Field Value

To display custom form field value on the Tutor LMS dashboard use the following code snippet.  

Depending on what values you want to display, use the class <div class=”tutor-dashboard-profile-item”> to add items. You need to edit this file on the following path

Location path: /tutor/templates/dashboard/my-profile.php

 * @package TutorLMS/Templates
 * @version 1.4.3
$uid = get_current_user_id();
$user = get_userdata( $uid );
$profile_settings_link = tutor_utils()->get_tutor_dashboard_page_permalink('settings');
$rdate = date( "D d M Y, h:i:s a", strtotime( $user->user_registered ) );
$fname = $user->first_name;
$lname = $user->last_name;
$uname = $user->user_login;
$email = $user->user_email;
$phone = get_user_meta($uid,'phone_number',true);
$bio = nl2br(strip_tags(get_user_meta($uid,'_tutor_profile_bio',true)));
You Custom Field
$your_variable = get_user_meta($uid,'your_field_name',true);
<div class="tutor-dashboard-profile-item">
     <div class="heading">
          <span><?php _e('You Field Label', 'tutor'); ?></span>
     <div class="content">
          <p><?php echo $your_variable ? $your_variable : "________"; ?> </p>

Now, you’re done. If you need any help, feel free to send an email to support. Do not forget to mention your theme name when you email for support on this specific customization.

Was this helpful?