• Resolved adelythe

    (@adelythe)


    Hi,

    I added two fields to the register form (first name and last name) but those won’t save in the database at all.

    The files I have worked on :
    – masterstudy-lms-learning-management-system/assets/js/register.js
    – masterstudy-lms-learning-management-system/stm-lms-templates/account/register.php

    The changes I made :

    In the PHP file :

    <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="heading_font"><?php esc_html_e('First Name', 'masterstudy-lms-learning-management-system'); ?></label>
                        <input class="form-control"
                               type="text"
                               name="first_name"
                               v-model="first_name"
                               placeholder="<?php esc_html_e('Enter first name', 'masterstudy-lms-learning-management-system'); ?>"/>
                    </div>
    
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="heading_font"><?php esc_html_e('Last name', 'masterstudy-lms-learning-management-system'); ?></label>
                        <input class="form-control"
                               type="text"
                               name="last_name"
                               v-model="last_name"
                               placeholder="<?php esc_html_e('Enter your last name', 'masterstudy-lms-learning-management-system'); ?>"/>
                    </div>
                </div>
            </div>

    In the JS file :

    function stm_lms_register(redirect) {
      var vue_obj = {
        el: '#stm-lms-register',
        data: function data() {
          return {
            vue_loaded: true,
            loading: false,
            login: '',
            email: '',
    		first_name: '',
    		last_name: '',
            password: '',
            password_re: '',
            message: '',
            status: '',
            site_key: '',
            become_instructor: '',
            degree: '',
            expertize: '',
            recaptcha: '',
            captcha_error: '',
            privacy_policy: true,
            has_privacy_policy: false,
            choose_auditory: false,
            auditory: ''
          };
        },
        methods: {
          hasPrivacyPolicy: function hasPrivacyPolicy() {
            if (!this.has_privacy_policy) {
              this.has_privacy_policy = true;
              this.privacy_policy = false;
            }
          },
          register: function register() {
            var vm = this;
            vm.loading = true;
            vm.message = '';
            var data = {
              'user_login': vm.login,
              'user_email': vm.email,
    		  'first_name': vm.first_name,
    		  'last_name': vm.last_name,
              'user_password': vm.password,
              'user_password_re': vm.password_re,
              'become_instructor': vm.become_instructor,
              'privacy_policy': vm.privacy_policy,
              'degree': vm.degree,
              'expertize': vm.expertize,
              'auditory': vm.auditory
            };
    
            if (vm.site_key) {
              grecaptcha.ready(function () {
                grecaptcha.execute(vm.site_key, {
                  action: 'register'
                }).then(function (token) {
                  data['recaptcha'] = token;
                  vm.processRegister(data);
                });
              });
            } else {
              vm.processRegister(data);
            }
          },
          processRegister: function processRegister(data) {
            var vm = this;
            vm.$http.post(stm_lms_ajaxurl + '?action=stm_lms_register&nonce=' + stm_lms_nonces['stm_lms_register'], data).then(function (response) {
              vm.message = response.body['message'];
              vm.status = response.body['status'];
              vm.loading = false;
    
              if (response.body['user_page']) {
                if (redirect) {
                  window.location = response.body['user_page'];
                } else {
                  location.reload();
                }
              }
            });
          },
        }
      };
      new Vue(vue_obj);
    }

    I successfully modified the basic WP registration form (by creating another plugin that only works with PHP and Ajax), but I want to do those changes on the MasterStudy LMS registration form. How can I achieve that ?

    Thank you very much for your help !

    Cheers,
    Adelythe

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter adelythe

    (@adelythe)

    Any help please ?

    Thread Starter adelythe

    (@adelythe)

    Nobody’s got an idea on how to solve this issue please ??

    Plugin Support supportstylemix

    (@supportstylemix)

    Hi,

    My sincere apologies for the late response.
    Thanks for reaching us!

    If you are having trouble getting things working, we will offer you to submit requests as a ticket to our SUPPORT PLATFORM:
    If you are a premium user, you can submit a request through this link
    If you are using the free version, add your requests to our support system. Sign up to the system through this link and submit your tickets there.

    We would love to make things right if you describe this issue in more detail. After getting the clearly explained request, we will then responsively assess the situation, try to find a problem/conflict to give you a proper solution or options whenever possible.

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘User Meta Fields not saving on registration’ is closed to new replies.