{"record":{"id":"53be9006037471e5","repo":"moodle/moodle","slug":"nopermissions-53be90","errorCode":"nopermissions","errorMessage":"nopermissions","messagePattern":"nopermissions","errorType":"error_code","errorClass":"moodle_exception","httpStatus":null,"severity":"error","filePath":"public/mod/forum/discuss.php","lineNumber":125,"sourceCode":"    $rsstitle .= ': ' . format_string($forum->get_name());\n    rss_add_http_header($modcontext, 'mod_forum', $forumrecord, $rsstitle);\n}\n\n// Move discussion if requested.\nif ($move > 0 && confirm_sesskey()) {\n    $forumid = $forum->get_id();\n    $discussionid = $discussion->get_id();\n    $return = $discussionviewurl->out(false);\n\n    if (!$forumto = $DB->get_record('forum', ['id' => $move])) {\n        throw new \\moodle_exception('cannotmovetonotexist', 'forum', $return);\n    }\n\n    if (!$capabilitymanager->can_move_discussions($USER)) {\n        if ($forum->get_type() == 'single') {\n            throw new \\moodle_exception('cannotmovefromsingleforum', 'forum', $return);\n        } else {\n            throw new \\moodle_exception('nopermissions', 'error', $return, get_capability_string('mod/forum:movediscussions'));\n        }\n    }\n\n    if ($forumto->type == 'single') {\n        throw new \\moodle_exception('cannotmovetosingleforum', 'forum', $return);\n    }\n\n    // Get target forum cm and check it is visible to current user.\n    $modinfo = get_fast_modinfo($course);\n    $forums = $modinfo->get_instances_of('forum');\n    if (!array_key_exists($forumto->id, $forums)) {\n        throw new \\moodle_exception('cannotmovetonotfound', 'forum', $return);\n    }\n\n    $cmto = $forums[$forumto->id];\n    if (!$cmto->uservisible) {\n        throw new \\moodle_exception('cannotmovenotvisible', 'forum', $return);\n    }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/moodle/moodle/blob/48ea8c33227277e916cdd4079dbecef448b37f2c/public/mod/forum/discuss.php#L107-L143","documentation":"Moodle generic moodle_exception error key ('error' component) thrown in mod/forum/discuss.php when the user lacks the mod/forum:movediscussions capability (capabilitymanager->can_move_discussions($USER) is false) and the source forum is not of type 'single' (that case gets its own specific message). It is the standard permission-denied sentinel of Moodle, with get_capability_string('mod/forum:movediscussions') supplied as the debug detail; the fault is the user's role assignment in that module context.","triggerScenarios":"Thrown at public/mod/forum/discuss.php:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ask a manager to grant the mod/forum:movediscussions capability in the forum's context.","Have a user with an appropriate role (e.g. teacher) perform the move.","Override the capability at the course/module level if ordinary users should be allowed to move discussions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"48ea8c33227277e916cdd4079dbecef448b37f2c","analyzedAt":"2026-09-14T20:34:48.527Z","contentChangedAt":"2026-09-14T20:34:48.527Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}