Custom profile fields in user

Custom profile fields in user

by Nikki Macfarlane -
Number of replies: 1
Apologies if this is not the right place to put this question - I could not see a forum that dealt with just with the User fields. I am trying to right some SQL that reads the custom profile fields and displays a menu for users to change just these. I do not want them making the changes through the user profile settings. When a profile field is a menu option, the menu options are stored in mdl_user_info_field table with each value option on a new row. I thought I might be able to use explode to display the different menu options available as a drop down list but there is no separator between each value - they are just shown on a new line. For example: Values available for the colour field would look like this in the table: red yellow blue How do I separate this array out into the values available so I can display them in a dropdown list? Thanks! Nikki
Average of ratings: -
In reply to Nikki Macfarlane

Re: Custom profile fields in user

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There is a separator - a newline character. Try using: explode("\n", $options); (just like all the Moodle code for working with these fields does).