"Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

"Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Ademola Akitoye -
Number of replies: 9

I recently upgraded my Moodle 2.3 to 2.4.1, everything runs well untill i try login in with other user account other than the admin account.

I created a new account, if I try login it gives the same error:

"Coding error detected, it must be fixed by a programmer: Context does not belong to any course "

The Administrator account does not have this  problem, it login succesfully with it.

Please, help.

Average of ratings: -
In reply to Ademola Akitoye

Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Ken Task -
Picture of Particularly helpful Moodlers

How did you migrate?  On server with 'git'? 

Download of 2.4.1+, unzipped, moved current moodle folder on server to moodle.back, then uploaded to server new moodle folder, etc.

If the latter, you must have moved the config.php file from old server to new server, but did you also get any add-on blocks/mods, etc. from old server to new server?  It could be a mod/block, etc. moved from old server to new server is not compatible.

Suggest turning on debugging to get more/specific information.

'spirit of sharing', Ken

In reply to Ken Task

Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Ademola Akitoye -

The upgrade was done exactly as suggested, all old plugins were updated...

If I make any other user an administrator, the user will login succesfully but any other user other than the Admin will throw the error.

Every other things works fine except this.

In reply to Ademola Akitoye

Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Ken Task -
Picture of Particularly helpful Moodlers

Debug output?

Ken

In reply to Ken Task

Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Ademola Akitoye -

Thanks for your response but how can I carry out the debuging? Don't remeber how to go about it again.

Thanks

In reply to Ademola Akitoye

Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Ken Task -
Picture of Particularly helpful Moodlers

Login to Moodle as an Admin level user.  Just  below the Site Admin link/menu on the front page there is a search box.  In the search box, type 'debug' and click search.  That should find where one turns it on.

Matter of fact, searching sometimes works when admin menu is not available for some reason.

'spirit of sharing', Ken

In reply to Ken Task

Ang: Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Jens Gammelgaard -
Picture of Translators

Hi,

What Plugins do you have activated on the frontpage?

I got your error experience, when I used Configurable reports on the frontpage. When I closed the eye on that block on the frontpage - the error was gone and the normal user could login again.

BR
Jens

In reply to Jens Gammelgaard

Re: Ang: Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Rafael Soares -

Hi Jens,

That's exactly what happened to me. I had the same issue with the Configurable Reports on the frontpage and closing the eye solved the problem.

Thanks a lot!

Rafa

In reply to Jens Gammelgaard

Re: Ang: Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Cindy Marcela Jiménez Ramírez -

Hola muchas gracias,

Utilizo Moodle 2.5 y me ocurria el mismo error , al ingresar como administrador no presentaba ningún problema, pero al querer  ingresar con otro usuario distinto aparce : " Detectado un error de codificación, debe ser corregido por un programador: Context does not belong to any course. " , efectivamente  Cerre el ojo del bloque CONFIGURABLE REPORTS desde la sesión administrador y logré ingresar con los otros usuario.

Pero igual  no entiendo el por que hay que hacer esto para que no aparezca dicho errror. Alguien me puede explicar que es lo que ocurre, igual resolví el problema, pero no quiero quedar con la duda.

 

Muchas gracias por la ayuda. 

Att: Cindy J.

 

In reply to Cindy Marcela Jiménez Ramírez

Re: Ang: Re: "Coding error detected, it must be fixed by a programmer: Context does not belong to any course" when login in moodle 2.4.1

by Giovanni Martarello -

Hello everybody,


I started working with Moodle this week and I am with this access problem.

A student is receiving this error message when accessing http: //moodle.../my/:

Coding error detected and shouldnt be fixed by a programmer: Context does not belong to any course.


Debug in the message:

[Thu Jun 16 11:39:22.908123 2016] [:error] [pid 13888] [client 200.195.135.2:53045] Default exception handler: Erro de codifica\xc3\xa7\xc3\xa3o detectado e deve ser corrigido por um programador: Context does not belong to any course.

Debug: \nError code: codingerror\n* line 5721 of /lib/accesslib.php: coding_exception thrown\n* line 7338 of /lib/accesslib.php: 

call to context->get_course_context()\n* line 42 of /blocks/porcentagem/block_porcentagem.php:

call to context_block->get_course_context()\n* line 288 of /blocks/moodleblock.class.php:

call to block_porcentagem->get_content()\n* line 230 of /blocks/moodleblock.class.php:

call to block_base->formatted_contents()\n* line 973 of /lib/blocklib.php:

call to block_base->get_content_for_output()\n* line 1025 of /lib/blocklib.php:

call to block_manager->create_block_contents()\n* line 473 of /lib/outputrenderers.php:

call to block_manager->ensure_content_created()\n* line 37 of /theme/essential/layout/includes/header.php:

call to core_renderer->standard_head_html()\n* line 28 of /theme/essential/layout/columns3.php:

call to require_once()\n* line 1015 of /lib/outputrenderers.php:

call to include()\n* line 945 of /lib/outputrenderers.php: 

call to core_renderer->render_page_layout()\n* line 164 of /my/index.php:

echo $OUTPUT->header();

call to core_renderer->header()\n, referer: http://e-learning.univiasoft.com.br/portal/


This error is only happening with this user, the error occurs:

    /**

     * Is this context part of any course? If yes return course context.

     *

     * @param bool $strict true means throw exception if not found, false means return false if not found

     * @return context_course context of the enclosing course, null if not found or exception

     */

    public function get_course_context($strict = true) {

        if ($strict) {

            throw new coding_exception('Context does not belong to any course.');

        } else {

            return false;

        }

    }


I've compared the mdl_user the user table fields with problem and a user where the problem does not occur and the fields are all the same.


I appreciate the help and I apologize for the English.