Best practice forum (Archived)
This forum discussion has been removed
Just deleting the records from mdl_my_pages might potentially cause some problems if some users have blocks set up which will then be orphaned. I've attached a script to reset all dashboards and clean up associated blocks which might be a good starting point.
Put this file in totara folder, open command line, navigate to totara folder, and run it with command "php dashboardreset.php"
Also if you remove the moodle/my:manageblocks capability from the Authenticated User and Learner roles then that should stop the users from making any changes to their blocks in future.
Thanks for this Ciaran. Really, thanks! Like you said, you risk orphaned records in related tables and it was a pain to "get it all right" when resetting blocks for a specific user.
To be clear, your script will reset the dashboard for all users, correct?
It's not mine, thank Yuliya for that script :-)
It goes through all users, sees if they have my_pages configured, removes any associated block instances, then cleans up the my_page. Should be fairly straightforward.
Is this a common problem then, would it make sense to actually have this incorporated into Core functionality?
Thanks Yuliya!
I had actually seen this discussed on some Moodle forums a while back, that perhaps it was coming to a Moodle near you. I don't know if I can fine the thread now, but I know there was discussion of putting this into Moodle. I think it would be nice to have in Core functionality.
The lesson here is, implementors should probably disable the ability to customize the my learning page right from the start, and re-introduce it later if the functionality is really desired. More often than not, in corporate, they don't want users customizing anything (in my own experience). It requires too much support down the road and is considered to be too confusing to the end user. The same goes for customizing the users' user profile page.
Here is the Moodle bug tracker I referenced. https://tracker.moodle.org/browse/MDL-26680