Menu type field offering names of registered users

Menu type field offering names of registered users

by Robert Allerstorfer -
Number of replies: 5
Is something possible? Instead of entering every selectable element of a Menu field "hardcoded" getting its elements dynamically from Moodle's mdl_user MySQL table? For instance, using something like $firstname $lastname resolves into a list off all registered Moodle users?
Average of ratings: -
In reply to Robert Allerstorfer

Re: Menu type field offering names of registered users

by Jose' Coelho -

I don't think that is possible. That information is stored in the database in mdl_data_fields.param1 that is a text field and the several lines are stored like that, in a big text (each option in a different line).

But, if you know SQL, you can make a select command to return all users, and copy/paste the names to the menu field.

Test it first. If you have many users, that solution can eventually not be very good.

In reply to Jose' Coelho

Re: Menu type field offering names of registered users

by Robert Allerstorfer -
Thank you Jose for your suggestion.

After intensively dealing with the database activity for the last days and nights I had to realize that I have been asking for too much. There are so many bugs in this module (still in 1.9+) so that I am currently happy if most things work as they are supposed to.

I would not recommend anybody to use it with an 1.8 Moodle because too many things do not even work there.
In reply to Robert Allerstorfer

Re: Menu type field offering names of registered users

by Robert Allerstorfer -
Now, in the latest 1.9+, there is something possible using the special tags ##firstname##, ##lastname## and ##user## if MDL-14396 would have been implemented. Since I really use this ability, I will try to solve it. If somebody else wants it, vote for it in the tracker.
In reply to Robert Allerstorfer

Re: Menu type field offering names of registered users

by Jose' Coelho -

It is not the same, one thing is filling the options of a menu type field with the users, another is showing the last user to edit a record (that is of course useful). You get my vote smile.

In reply to Jose' Coelho

Re: Menu type field offering names of registered users

by Robert Allerstorfer -
Thanks for your vote on MDL-14396, Jose. As you can see there, I have already written and submitted a patch that can be used to solve that problem. Yes, that one only shows who did when the last edit.

Regarding my original wish, having a menu where all users can be selected that own records within the database ID in question, please see my last 2 comments at MDL-9907, where I am suggesting the selection menu tags ##usersmenu## and ##usersmultimenu##. The text boxes ##firstname## and ##lastname## have recently been added.