Recent upgrade to 1.8 now has no Admin access

Recent upgrade to 1.8 now has no Admin access

by Tom Walker -
Number of replies: 2
Recent upgrade to 1.8 now has no Admin access. All users now log in with basic guest access and cannot even view courses. The admin users cannot even access the Admin page to check roles and permissions. The primary administrator was working with roles before this problem but did not make any changes that should have caused anything like this, she was just trying to figure out how to give a student access to a course and all of its content. Now all courses come up saying 'This course is not enrollable at the moment' Please help, need to get this system working right again soon...

Thanks

Tom Walker
Average of ratings: -
In reply to Tom Walker

Re: Recent upgrade to 1.8 now has no Admin access

by Tiogshi Laj -
You should be able to assign a user the admin role to the site right in the database, if nothing else. From there you can rebuild things either in the database, or through the moodle frontend.

Find the user-id of the person you want to be the admin, by their login name, by running this query...

SELECT id,username FROM mdl_user WHERE username like '%bob%';

Then, find the context id of the site.

SELECT * FROM mdl_context WHERE contextlevel=10;

Next, find the role-id of the admin role.

SELECT id,shortname FROM mdl_role WHERE shortname='admin';

Now bind the user to that role in that context.

INSERT INTO mdl_role_assignments (roleid, contextid, userid, timemodified, enrol) VALUES ({admin role id}, {context id}, {user id}, NOW(), 'manual');

Replacing {admin role id} with the id number you found during the role querym {context id} with the id number of the site context, and {user id} with the id of the user who you want to make admin.

I hope that helps you at least get back on your feet.