Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28452

Convert user profile fields for messaging/networking into custom profile fields

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test the upgrader steps

      1. Create a new Moodle instance that does not have this patch installed
      2. Turn on developer mode
      3. Copy the attached file ‘usersocialdata.php’ to your moodle root folder
      4. Run this command php usersocialdata.php This will generate about 500 users with the data in the columns ICQ number, Skype id etc.
      5. Navigate to Site Administration > Users > Permissions > Userpolicies
      6. In Hide user fields select Skype ID and Yahoo ID
      7. Login to Moodle and visit the profile page of one of the new test users
      8. verify you see the fields icq, skype etc. in the User details section
      9. Install this patch and run the upgrader
      10. Visit the page of the test user again
      11. verify you still see the same fields: i ICQ number, Skype id etc. in the User details section.
      12. verify only the Skype, ICQ and url fields have links, the other should just display the user data without a link.
      13. Navigate to Users > Accounts > User profile fields
      14. Search for profile field "Skype ID" and click the gear icon
      15. Verify the field "Who is this field visible to" is set to "Visible to user teachers and admins"
      16. Go back and Search for profile field "AIM id"
      17. Verify the field "Who is this field visible to" is set to "Visible to everyone"

      Test the social profile field

      1. This test needs to be done after completing the previous test
      2. Navigate to Site admin > Users > User profile fields
      3. Verify you see the all social profile fields listed
      4. Click the cog icon in row Skype ID
      5. Verify in the select input 'networktype' Skype ID is selected
      6. Change on of the settings, for example “Display on signup page”
      7. Save changes
      8. Click the cog icon in row Skype ID again
      9. Verify the changes persist
      10. Now change the value Skype ID to Yahoo ID in the select input 'networktype' and save changes
      11. Verify you can change and there now exists 2 fields of type 'Yahoo ID'
      12. Click the delete icon for profile field Yahoo ID
      13. Verify you can delete the profile field

      Test the translations

      1. This test needs to be done after completing the previous test
      2. As the administrator Install the french language pack
      3. Navigate to a test user profile page
      4. Change the site language to French
      5. Verify the social profile fields are now displayed in French “Identifiant ICQ, Identifiant Skype etc”

      Test the new custom profile field visibility

      1. Create 3 new users "Test student", "Other student" and "Test teacher"
      2. Enrol the users into a course "Test course" with role student for "Test student" and 'Other student' and role teacher for "Test teacher"
      3. Navigate to Site admin > Users > User profile fields
      4. Create a new profile field of type Text input of type
      5. Set "Short name" and "Name" to "Hobbies"
      6. Set "Who is this field visible to?" To "Visible to user teachers and admins"
      7. Navigate to the profile of "Test student"
      8. Set the profile field Hobbies for the user to "Ice Skating"
      9. Login as user "Test student" and navigate to course "Test course"
      10. On the course participants list click the link to the profile page of "Test student"
      11. verify You can see "Ice Skating" listed in profile field "Hobbies"
      12. Login as user "Other student" and navigate to course "Test course"
      13. On the course participants list click the link to the profile page of "Test student"
      14. verify You can not see "Ice Skating" listed in profile field "Hobbies"
      15. Login as user "Test teacher" and navigate to course "Test course"
      16. On the course participants list click the link to the profile page of "Test student"
      17. verify You can see "Ice Skating" listed in profile field "Hobbies"
      Show
      Test the upgrader steps Create a new Moodle instance that does not have this patch installed Turn on developer mode Copy the attached file ‘usersocialdata.php’ to your moodle root folder Run this command php usersocialdata.php This will generate about 500 users with the data in the columns ICQ number, Skype id etc. Navigate to Site Administration > Users > Permissions > Userpolicies In Hide user fields select Skype ID and Yahoo ID Login to Moodle and visit the profile page of one of the new test users verify you see the fields icq, skype etc. in the User details section Install this patch and run the upgrader Visit the page of the test user again verify you still see the same fields: i ICQ number, Skype id etc. in the User details section. verify only the Skype, ICQ and url fields have links, the other should just display the user data without a link. Navigate to Users > Accounts > User profile fields Search for profile field "Skype ID" and click the gear icon Verify the field "Who is this field visible to" is set to "Visible to user teachers and admins" Go back and Search for profile field "AIM id" Verify the field "Who is this field visible to" is set to "Visible to everyone" Test the social profile field This test needs to be done after completing the previous test Navigate to Site admin > Users > User profile fields Verify you see the all social profile fields listed Click the cog icon in row Skype ID Verify in the select input 'networktype' Skype ID is selected Change on of the settings, for example “Display on signup page” Save changes Click the cog icon in row Skype ID again Verify the changes persist Now change the value Skype ID to Yahoo ID in the select input 'networktype' and save changes Verify you can change and there now exists 2 fields of type 'Yahoo ID' Click the delete icon for profile field Yahoo ID Verify you can delete the profile field Test the translations This test needs to be done after completing the previous test As the administrator Install the french language pack Navigate to a test user profile page Change the site language to French Verify the social profile fields are now displayed in French “Identifiant ICQ, Identifiant Skype etc” Test the new custom profile field visibility Create 3 new users "Test student", "Other student" and "Test teacher" Enrol the users into a course "Test course" with role student for "Test student" and 'Other student' and role teacher for "Test teacher" Navigate to Site admin > Users > User profile fields Create a new profile field of type Text input of type Set "Short name" and "Name" to "Hobbies" Set "Who is this field visible to?" To "Visible to user teachers and admins" Navigate to the profile of "Test student" Set the profile field Hobbies for the user to "Ice Skating" Login as user "Test student" and navigate to course "Test course" On the course participants list click the link to the profile page of "Test student" verify You can see "Ice Skating" listed in profile field "Hobbies" Login as user "Other student" and navigate to course "Test course" On the course participants list click the link to the profile page of "Test student" verify You can not see "Ice Skating" listed in profile field "Hobbies" Login as user "Test teacher" and navigate to course "Test course" On the course participants list click the link to the profile page of "Test student" verify You can see "Ice Skating" listed in profile field "Hobbies"
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_27_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_310_STABLE, MOODLE_31_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull from Repository:
    • Pull 3.11 Branch:
      MDL-28452-311
    • Pull Master Branch:
      MDL-28452-master

      Description

      These fields are pretty easy to convert during an upgrade.

      1) Create a new user custom field. If it's not possible to replicate the full functionality using a text field type (eg note that Skype can show an online/offline icon) then you will have to create a special new user profile field type as a new plugin.
      2) Copy existing data into this new field.
      3) Drop old column from the user table.
      4) Make sure that all code no longer relies on this field.
      5) Make sure that all code that provides user data (eg web services) behaves as expected and APIs are not changed.

      Fields include:

      • Web URL
      • ICQ
      • Skype
      • AIM
      • Yahoo
      • MSN

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              basbrands Bas Brands
              Reporter:
              dougiamas Martin Dougiamas
              Peer reviewer:
              Ferran Recio Ferran Recio
              Integrator:
              Adrian Greeve Adrian Greeve
              Tester:
              Peter Dias Peter Dias
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              27 Vote for this issue
              Watchers:
              44 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 weeks, 1 day, 6 hours, 51 minutes
                  2w 1d 6h 51m