How to hide the Edit button on 'my' home page?

How to hide the Edit button on 'my' home page?

by Arnaud Saint-Georges -
Number of replies: 5
Bonjour,

I am using Moodle 1.8.6. All the users are redirected to their 'my' page (mymoodleredirect = true).
As admin, I have added some fixed blocks to this 'my' page.
I have prevented the users to modify this 'my' page (its blocks) by setting moodle/my:manageblocks capability to 'Prevent' for the "authenticated user" (which is my default role).
OK, they can no more modify this page. However the standard button [Edit this page]/[Normal mode] still appears on this 'my' page and is clickable. How can I hide this button?

Arnaud
Average of ratings: -
In reply to Arnaud Saint-Georges

Re: How to hide the Edit button on 'my' home page?

by Craig Meltzer -
Hi Arnaud,

I can't say for sure is this is best practice, but here's what I did:

Go to line 49 (in Moo 1.9) in 'my/pagelib.php'

Replace this line:
print_header($title, $header,$navigation,'','',true, $button, $loggedinas);

With this:
print_header($title, $header,$navigation,'','',true, '', $loggedinas);

So we just send an empty string instead of $button.

Craig
In reply to Craig Meltzer

Re: How to hide the Edit button on 'my' home page?

by Arnaud Saint-Georges -
Thank you Craig for your workaround.

In my case, it's works fine smile.

However, as you said, it's not an universal solution. Because it doesn't work if some users have the capability to change this 'my' page. In this case they need this button.

If there is no other solution, I will open a new bug in the tracker.
In reply to Craig Meltzer

Re: How to hide the Edit button on 'my' home page?

by Zachary Johnson -
Did you mean line 59 rather than 49? I'm looking in the code right now and I'm a bit confused.

Thanks,
Zach
In reply to Zachary Johnson

Re: How to hide the Edit button on 'my' home page?

by M van Adrichem -
I really hope they will fix this. I want it solved too. voted on tracker for you.