Lost admin rights

Lost admin rights

by Bradley Splittorff -
Number of replies: 21
I had just set my default role for all students to authenticated user.
I did this after blocking all rights for authenticated user. Now when I log in as admin for my sight I have no editing authority.
Can anyone suggest a fix.
Average of ratings: -
In reply to Bradley Splittorff

Re: Lost admin rights

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Have a look at....

http://moodle.org/mod/forum/discuss.php?d=103995

My script...

http://moodle.org/file.php/5/moddata/forum/941/459809/adminfix.php

...can get you out of trouble quite often (it resets everything to do with roles)
In reply to Howard Miller

Re: Lost admin rights

by Nina Edlin -
Hi, I am running this script, wondering how long it takes to run generally? I am getting stuck at 'reloading context', wondering if i'm actually stuck/ impatient/ or a fool?


In reply to Nina Edlin

Working again

by Nina Edlin -
Did I misunderstand the script? I thought it would reset the password to 'moodle', in fact the password was not reset, I had exactly the same password and username, but the permissions had changed...

I'm glad it worked! thanks for your help.
In reply to Nina Edlin

Re: Working again

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It should be instant... Mmmm... as long as you got it working, that's the main thing smile
In reply to Bradley Splittorff

Re: Lost admin rights

by Jack Briner -
I may have a similar problem. When I log on as admin, I only get the list of courses that I/we offer. I have lost the ability to see the sidebars that allow changes to courses/users/etc. I've attached a pdf version page that shows up when I login.

I've looked at the SQL database, but I'm not sure what attribute needs to be restored.

Thanks for your help.
In reply to Jack Briner

Re: Lost admin rights

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If you use my adminfix.php script above it might help. However, do note that it resets all the standard roles to their defaults and also resets all role related site settings. It's a big hammer (!), but if you are stuck you are stuck!

The instructions are in the comments at the top.
In reply to Howard Miller

Re: Lost admin rights

by Jack Briner -
Thank you for your help. It worked great. I have modified the adminfix.php script to remove the file after it is run and to force the administrator to reset the password on logging in.

If it is unclear to others how to use this file, here is a short explanation.
  1. Drop this file (ftp, etc.) in the root directory of your server
  2. Direct your browser to http://yourserver/adminfix.php

Note: The admin password is changed to 'moodle' and all of the roles are reset. The file must be removed after it is used. This new version of adminfix.php tries to remove itself. If it reports that it cannot remove it, you need to remove it manually. If the removal went ok, you are redirected to login and to reset your password.

The modified file is located at http://moodle.org/file.php/5/moddata/forum/941/466477/adminfix.php

Jack Briner
http://jacksjots.com
In reply to Jack Briner

Re: Lost admin rights

by michael mc sherry -
I would like to add my thanks to all the contributors above, this saved me a major embarassment at work. Have a new moodle, only up a week, stupidly overrode the administrator role in a course. The one i'm using as a staff forum. blush

Thanks to the above was finally able to get the admin rights back for the course.
So again to all those so will to offer help and advice thanks!!!!

Michael Mc S
In reply to Jack Briner

Re: Lost admin rights

by Max Parish -
I, too, want to thank the brains behind this file. Though my plight was not as serious as others', it was a great help!

-Max
In reply to Jack Briner

Re: Lost admin rights

by Gerald Grow -
The adminfix.php file worked for me. Thanks! That was a life-saver.
In reply to Jack Briner

Re: Lost admin rights

by Big Faced Boy -
Unfortunately, this seems to have made matters worse for me. My administrator now only has student access rights, by the looks of it.

All I got when I ran this file was:

"RESETING DEFAULT ROLES

RELOADING CONTEXT"

The page status said "done". No error message about not being able to remove itself, and adminfix.php remains on the server... My password hadn't changed, either.


I took a quick look at the script and it certainly appears that I should get more mesages than I am getting.

Please help!

In reply to Big Faced Boy

Re: Lost admin rights

by Ivan Labombarbe -

I am tryign to run the adminfix.php.

I get the 404 error.  I know the server is working because I can go to standard login ok.  I placed the file in the Moodle root which in our case is http://myschool/moodle/ My school is a psuedonym.

I use a simular http://myschool/moodle/adminfix.php and get the 404 error.

Any ideas why it can find the file.

Ivan

In reply to Ivan Labombarbe

Re: Lost admin rights

by Ivan Labombarbe -

Hello anybody,

Do I need to compile the PHP file to get it to be recognized.  I am new to PHP.

Ivan

In reply to Ivan Labombarbe

Re: Lost admin rights

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
PHP does not need to be compiled. It is interpreted when you go to the corresponding URL, so you just need to make sure that the adminfix.php file is in the moodle folder on the server.
In reply to Tim Hunt

Re: Lost admin rights

by Ivan Labombarbe -

Hi Tim,

I did make sure it was under the moodle folder in the place where our config.php is located.

Ivan

In reply to Jack Briner

Re: Lost admin rights

by Ivan Labombarbe -

I could reallu use some help.  I know I messed up by reseting authenticated role to be pretty much everything as prohit.  I can not get in to do any administration.  We are starting a new class in October and I have to get back in. 

I have uploaded the adminfix.php using WS-FTP to the server under the root which is /moodle.  It is in the same areas as the config.php.

All I get is the 404 page not found.  I don't know PHP and how to get it to recognize the file is there.

Ivan

In reply to Bradley Splittorff

Re: Lost admin rights

by Todd Mikolayenko -
I'm not sure if the problem that I have is related.

Just updated ubuntu and my moodle to 1.9.4.

Everything seemed fine, but I have one course where I am missing the centre and right side blocks. Most importantly I am missing the Admin block. When I change roles to Student things appear as normal. I can turn editing on and off, but I cannot add blocks.

The rest of my courses are good. I tried creating a new course and everything worked.

I tried the adminfix.php script with no improvement.

Hope someone has an idea for me.
In reply to Todd Mikolayenko

Re: Lost admin rights

by Jonathan Moore -
Try entering the URL for admin directly.

mydomainname/path_to_moodle/admin/index.php

If you can get an error use it as a search term on google, or post here.

If no error go into Server -> Debugging and enable. See if you get any error output now on the screens not displaying properly.

Direct path to debug screen is
admin/settings.php?section=debugging

Again you can try entering directly into your browser location if navigation is broken.

If you get debugging on repeat the process of putting the errors into Google or the forums to see if it finds solution to the exact error you are getting.

In reply to Jonathan Moore

Re: Lost admin rights

by Todd Mikolayenko -
The debugger helped me track it down to a teacher admin block I had installed in 1.8. I guess I had only added the block to the one course.

Thinks are working now, thanks.