Here at pre-high school education center of TTI SFU we’ve developed an improvement for Moodle administration tool, user bulk actions, to implement it on our site.
Its code was updated so that now it has a plug-in structure, enabling developers to add new bulk actions functionality more easily, on the base of single code. Shortly, all actions are stored in their own subfolders in /admin/user/actions/ folder, and the base code redirects user to index.php in the action’s folder. To simplify the implementation even further, necessary language strings can be stored in corresponding subfolder of /admin/user/lang/ folder and fetched by get_string function with action-specific parameters. All “standard” actions (view, confirm, delete…) were edited to fit this plug-in structure and perform the same.
Additionally, two more actions were added: bulk user enrolment and bulk user unenrolment. These enable administrators to quickly enrol users to, or remove them from specified list of courses. Bulk enrolment also gives opportunity to specify the role, which is assigned to users, and to automatically add them to groups with a specified name (the names are taken from the selected courses automatically; if the group is missing in any course, it will not be created - users will be just enroled). The role assignment may also be hidden. Currently implemented languages for those plug-ins are en_utf8 and ru_utf8.
This improvement may resolve bug 10002 and extends the functionality of patch, accepted in bug 15449.
We would like to share this piece of code, and looking forward to hear any response or suggestions. We also would appreciate to see our patch in standard Moodle distrib.
To install this updated tool you have to delete (or rename for backup) the whole /admin/user/ folder and replace it with the one in the attachment.
Here are some screenshots:
So you can see that we don't have bug 16701 problem here, and that actually our solution is more complex and convenient than bug 15449, not to mention the plug-in system, which is the main improvement.
Also I want to say that the ideas of it are not so new - gradebook plug-in system was the "insight"
I'm confused of how would i make this work with mine.. i'm new with this and adding plugins and stuffs like this is my current problem.. i already tried some tweaks. but it doesn't change the user actions when i check it on my localhost... can i get a help? thanks a lot for the idea btw,
Update was uploaded to tracker: bug 16793
Of course, another way is to display only those names, which are available in ALL courses, but this might not be always convenient.
And yes, there is an option not to perform group adding at all - it's the first and always available element of group names select, "Do not add".
And yes, we still would like to hear any comments about the functionality
One huge advance in functionality would be to be able to limit the users one sees in bulk actions based on site course group.
Administrator
--Site1 Adminstrator
--Site2 Administrator
--Site3 Administrator
Site1 can only see users in his/her 'group', not all users on the site. I was thinking about site level groupings for this, but...it may be more flexible to do it a different way - maybe with a Bulk actions block that could operate at the category level, e.g. category admin sees only users in his/her category...
If by categories you mean course categories - that wouldn't be a variant as well, because almost always users are enroled in courses of many categories.
Actually, I'm not quite sure for what exactly does one need to divide users between administrators with their rights only to those who are in the same group (of course, if they are administrators, and not teachers, for example). But if there's only a need to divide users for conveniency, extra profile fields are out there Bulk user actions combine just fine with them.
settings.php file has the following format:
<?php
$requirecapability = 'moodle/user:update';
?>
where 'moodle/user:update' should be changed to a needed capability.
If settings.php file is missing, the action is not included in the list.
To install this update, simply unpack the contents of BUA_update.zip to your /admin/user directory. The archive already contains settings.php files for all standard actions, as well as bulk enrolment and unenrolment.
Another new functionality may be to add db/access.php files to actions, which require new capabilities to be added into the system. But this will work only if we include code to check and update capabilities:
// /admin/index.php:486
upgrade_plugins('admin/user/actions', $CFG->admin.'/user/actions', "$CFG->wwwroot/$CFG->admin/index.php");
and new plugin type to /lib/access.php, function load_capability_def.
The question is - is there any need to add it? Or maybe standard capabilities are enough for bulk user actions to limit their display in the list - and their usage? Any suggestions are welcome.
See MDL-17010 for corresponding tracker issue.
I first installed the original files (bulk_user_actions.zip), and that worked perfectly.
Then I found the revised version on this post (BUA_update.zip), so I installed that instead. But this version doesn't quite work. The drop-down "With selected users..." only contains text like ""pluginname"" instead of the correct plugin title.
I'm pretty sure I installed it correctly, including the language files. Any idea what could be wrong?
I've reverted to the earlier version for now.
Well, I'm not really sure, but probably I just forgot to add something in that update I suggest you to download the latest version from here: http://download.moodle.org/download.php/patches/bulk_user_improvements.zip
It's linked to CVS, so if I make any changes, the zip will be updated. I think it's better just to delete current version and install new one.
Thanks.
Please be sure you have the latest version by downloading the improvement from here.
has anybody an idea on how to select/filter user accounts that were never used. The "Browse List of Users" shows NEVER in the "Last Access" field, but you can not search/filter for this value in the "Bulk user actions".
Thanks for any hints, Rosario
Rosario
Rosario
Hi Vlas.
In moodle 1.9.3 bulk user actions course enrol run OK, but not remove. When I have finished this actions (remove user from a course/s) width happy result, I´m going to a course and user not removed.
Any solution?
Best Reggards.
Sorry, I´m wrong, all run OK. The user I tested has directory permissions, so this is the cause he is a student after remove from BUA
Great work!
Someone know a similar code to management user roles? I use tim role´s report, but It´s only limited to management one user.
Reggards.
Are there any known issues with this? Is there not a page for it in the plug-ins section of Moodle.org?
Can anybody update this code for 1.9.7 moodle version?
Thanks...
What do you mean by "update this code for 1.9.7"?
Force password change?
HTML editor in message form?
I think he's talking about the items 'Enrol to courses' and 'Remove from courses', they're out in Moodle 1.9.7.
The other items work fine.
Our improvements replace standard Bulk user actions and at this moment doesn't contain Force password change and HTML editor in message form.
In next couple days I will add those functionality.
Your replace standard Bulk user action is a great improvent, I cannot understand it isn't in Standard Moodle distrib
Anyway, Thank you very much.
This was what I mean...
I agree with Nacho. Your code is one of the best patchs in Moodle...
Installing:
1. delete (or backup) the contents of /admin/user/ folder
2. replace them with the contents of bulk_user_improvements folder inside the archive you've downloaded.
Latest version.
First, thanks so much for this contribution. I am very happy to have many of the capabilities that are included here. One very powerful addition for us is the ability to filter based on custom added profile fields. Excellent!
I'm having a small issue that appears it may be a little bug...? When I create a filter and try to download the results by adding all of the users retrieved by the filter and selecting "download" from the "With selected users" dropdown menu I get a page that has three links (Download in text format, Download in ODS format, Download in Excel format). If I click on one of these links (any of them) I get the content displayed in my browser page. If I option click on the link (I'm on a Mac) I get the file downloaded as a php file (index.php). The contents (results of the filter) are included in the file but shouldn't this be downloading the file immediately upon clicking on the link and shouldn't the file be formatted in the .txt, .ods, xls, formats?
Jason
Maybe this would be too difficult in terms of programming and database bandwidth??
Jason
Vlas no longer works with us.
One very powerful addition for us is the ability to filter based on custom added profile fields.
It is feature from standard distrib.
I'm having a small issue that appears it may be a little bug...?
It works for me (Moodle 1.9.7)
I am sorry to hear that Vlas is no longer with you.
As for the ability to filter based upon custom user profile fields, sorry, I hadn't played with the filters for a while and didn't even realize that the ability to filter by profile field was an option.
Also, in reference to the download functionality, I guess this is additional incentive for me to upgrade to the latest version of Moodle
Finally, since the filters are a part of the core, I understand. I will pursue the additional filter conditions elsewhere.
Thanks
Jason
I did a little reading and dug through the files and realized that adding the functionality that I wanted was quite easy so I did it myself. I don't know if anyone is interested in being able to use the "greater than" and "less than" filters on the profile fields but we have a need. Additionally, I don't know if the way I wrote it is the best way to do it so use this at your own risk. I've simply added the following two lines to the operator code:
case 8: // is greater than
$where = "data > '$value'"; break;
case 9: // is less than
$where = "data < '$value'"; break;
and added strings so that the operators are labeled correctly. If you wan to try this just replace the profilefield.php file with the one attached and the filters.php file in your language directory with the one attached. That should do it.
Jason
**Note** - This is a hack to the core so if you update your site it will be overwritten.
**EDIT** P.S. Just figured I'd go ahead and add them all so I added "greater than or equal to" and "less than or equal to". Also, fixed a little issue I had with the labeling of the filter after it had been created. I'm overwriting the original upload here so hopefully only the final version is visible.
Jason
I've noticed that if you have many users in your system (we have 4000+) and your server isn't blazing fast (our site runs on a dedicated MacMini running Ubutnu) that this filter takes a LOT of time (almost 10 seconds) with a heavy load on the processor. I'm guessing that is because all of the users that have already been retrieved from the database are being filtered by the script. It may be more efficient to pull only the relevant users from the database with an SQL query but that would involve way more coding that I'm capable of.
Or, I could be completely wrong!
Jason
Hi,
did you solve that problem?
I'm having a small issue that appears it may be a little bug...? When I create a filter and try to download the results by adding all of the users retrieved by the filter and selecting "download" from the "With selected users" dropdown menu I get a page that has three links (Download in text format, Download in ODS format, Download in Excel format). If I click on one of these links (any of them) I get the content displayed in my browser page. If I option click on the link (I'm on a Mac) I get the file downloaded as a php file (index.php). The contents (results of the filter) are included in the file but shouldn't this be downloading the file immediately upon clicking on the link and shouldn't the file be formatted in the .txt, .ods, xls, formats?
Thanks
contributing slovak translation for your patch. Translation is located in folder ./Actions/*/lang/sk_utf8.
http://github.com/andreev-artem/bulk_user_improvements
Zip download: http://github.com/andreev-artem/bulk_user_improvements/zipball/master
P.S. Repository contain enhancement for action "Enrol to courses" added ability to enrol in several groups.
Artem - Could you make sure that the Git path is provided in the tracker (I believe the issues is MDL-17010)? I just want to make sure that when the developers review this that they have the code to look at. I believe the plugin structure for dealing with bulk user actions is a great step forward and would allow for some custom plugins to be dropped in without modifying core code. I'm always happy to see more modularity. Peace - Anthony
Hello, Anthony!
I posted comment to MDL-17010.
At this moment it is not major patch. I reworked it to admin report "Advanced bulk user actions" to simplify development process.
But I think it would be better if Moodle has something like User actions API, which can be used in different Moodle modules...
Thanks Artem - That should give us an idea of at least one way that it could be done. Peace - Anthony
Hello,
Below is the plugin with the Spanish translation.
A greeting
-------------------------
Hola,
Adjunto el plugin con la traducción al español.
Un saludo
So, we would filter by course and then by the members of particular groups within that course.
Geoffrey - I like the idea, it would be more consistent with the behavior we see when viewing the course participants. If groups are available you can select the group you want, then role, etc. In fact, I wonder if the solution is to make some of those options available on the drop down of things to do with selected users on the course participants page if the user has the requisite capabilities. I would think that if we were to add the filter interface to the course participant page (/user/index.php) and ensure that all of the options available to that user are in fact in the drop down list of actions to perform to the selected users that would be a definite improvement. In 1.9, the list is to send a message, add a note, add a common note, and extend enrollment. In 2.0, the enrollment option is removed and is in the navigation bar. Under bulk user actions we have confirm, delete, display on page, download and force password change. I think the ability to add a note would be helpful on the bulk user page (/admin/user/user_bulk.php). I think this would make the pages more consistent in the sense that when looking at a list of users, you can select a group of them and perform some action and with the improved capability checks, I think making everything that is possible/reasonable to be done to those selected users is not a bad idea. Peace - Anthony
Hi, Geoffrey!
Recently I've added action "Select for bulk actions" on page "Participants" in my code base. It may be workaround for people, who don't be afraid to patch core code...
Bulk user actions improvement reworked from major patch to admin report "Advanced bulk user actions" to simplify development process.
Installing:
Extract the contents of andreev-artem-moodle_admin_report_advuserbulk-xxxxxxx folder inside the archive you've downloaded to folder admin/report/advuserbulk.
After installation you can find link "Advanced bulk user actions" in Administration ► Users ► Accounts
Git: https://github.com/andreev-artem/moodle_admin_report_advuserbulk
I'm confused of how would i make this work with mine.. i'm new with this and adding plugins and stuffs like this is my current problem.. i already tried some tweaks. but it doesn't change the user actions when i check it on my localhost... can i get a help?
I'm unable to see any change in drop downs of bulk user actions after extracting to "advuserbulk" in admin/reports...no luck!
Am I doing something wrong?
Do you use Moodle 1.9? If yes, do you have "Advanced bulk user actions" nearby "Bulk user actions" in the admin menu?
mine is the 2.0.3 version.. and i am not seeing any "advance bulk user actions" in my localhost..
At now report_advuserbulk is not compatible with Moodle 2.x.
https://github.com/andreev-artem/moodle_admin_report_advuserbulk/issues/1
Yes Artem, I'm using Moodle 1.9.
I can't see "Advanced bulk user actions". Hope this is not because, I use MS SQL, not MySQL?
This report doesn't create any DB tables on install. Do you receive any errors while installing plugin?
Thanks for the quick reply..as usual.
I got this issue fixed. Under Admin>Notifications, there was an update prompt for Advance Bulk User, I selected that. It started working now.
Thanks a lot! This is very useful.
Hi.
I install this plugin in my moodle. My moodle version is 1.9.12. But moodle don't accept this plugin. It's exchange my home page. I removed the directory but it is not change.This moodle is vert very important for me. Please tell me how can i remove this plugin?
Help me
Hello Arteem,
Please update the module bulk user action into version 2.x
because in my campus already use that version for studying.
And the site already running for 8 teacher.
Thanks a lot for your help at this matter.
Best Regards,
Ervan
It is partially ported to 2.x: https://github.com/andreev-artem/moodle_admin_report_advuserbulk/tree/WIP_MDL_20
Hi Artem,
When do you think can be fully ready for the version 2.x? It is a very useful plugin.
Thank you very much for your work.
A greeting
P. S. Translated with google. Sorry for errors.
I am trying to download all my users, and its not working. It gives a blank page! Anyone experiencing this?
Cheers
I think the last time I encountered someone with this issue it was a large CSV file and a small server session time out setting.
Hi Artem,
I found the latest version here:
https://github.com/andreev-artem/moodle_admin_tool_advuserbulk
but sadly it doesn't work in 2.5. I find your improved bulk user actions tool extremely helpful.. Is there a chance that you could let us know what your plans are for updating it to 2.5?
Many thanks,
Christoph
Hi Artem,
Sorry to reply to such an old thread, but I was wondering if you had any luck with getting this working in 2.5? We are currently using 3.0, so was hoping you may have some advice or be able to point me to an similar solutions that you used to do the same job as this plugin?