mobilesmsfieldmoodleuser-accounts

Add mobile number field in my moodle site


How can I add a field (specifically mobile number field) in my moodle site such that every new user is asked to enter his/her mobile number. In short, the mobile number field is required.

I have to accomplish this so that i can send messages to my moodle site users via their inputted mobile number.


Solution

  • Use a custom profile field :

    Go to site admin -> users -> accounts -> user profile fields

    Then create new field -> text input

    Choose a shortname etc.

    Then select yes for "required" and "display on sign up page"

    The data will be available in

    SELECT d.userid, d.data AS mobilephone
    FROM {user_info_data} d
    JOIN {user_info_field} f ON f.id = d.fieldid AND f.shortname = 'mobilenumber'