mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
Merge branch 'MDL-82359-main' of https://github.com/sammarshallou/moodle
This commit is contained in:
commit
e6146bca1b
8 changed files with 125 additions and 37 deletions
|
@ -530,9 +530,6 @@ $string['postmailinfo'] = 'This is a copy of a message posted in {$a}.';
|
|||
$string['postmailnow'] = '<p>This post will be mailed out immediately to all forum subscribers.</p>';
|
||||
$string['postmailreply'] = 'To reply click on this link: {$a}';
|
||||
$string['postmailsubject'] = '{$a->courseshortname}: {$a->subject}';
|
||||
$string['postrating1'] = 'Mostly separate knowing';
|
||||
$string['postrating2'] = 'Separate and connected';
|
||||
$string['postrating3'] = 'Mostly connected knowing';
|
||||
$string['posts'] = 'Posts';
|
||||
$string['postsfrom'] = 'Posts from';
|
||||
$string['postsmadebyuser'] = 'Posts made by {$a}';
|
||||
|
|
|
@ -6912,3 +6912,50 @@ function forum_refresh_events(int $courseid, stdClass $instance, stdClass $cm):
|
|||
|
||||
forum_update_calendar($instance, $cm->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback adds navigation to view user posts if the navadduserpostslinks config is on.
|
||||
*
|
||||
* @param navigation_node $usernode User node within navigation
|
||||
* @param stdClass $user User object
|
||||
* @param \core\context\user $usercontext User context
|
||||
* @param stdClass $course Current course
|
||||
* @param \core\context $coursecontext Course context
|
||||
*/
|
||||
function mod_forum_extend_navigation_user(
|
||||
navigation_node $usernode,
|
||||
stdClass $user,
|
||||
\core\context\user $usercontext,
|
||||
stdClass $course,
|
||||
\core\context $coursecontext,
|
||||
): void {
|
||||
global $CFG;
|
||||
if (!empty($CFG->navadduserpostslinks) && $coursecontext instanceof \core\context\system) {
|
||||
$baseargs = ['id' => $user->id];
|
||||
|
||||
// Add nodes for forum posts and discussions if the user can view either or both
|
||||
// There are no capability checks here as the content of the page is based
|
||||
// purely on the forums the current user has access too.
|
||||
$forumtab = \navigation_node::create(get_string('forumposts', 'forum'));
|
||||
$forumtab->add(
|
||||
get_string('posts', 'forum'),
|
||||
new moodle_url('/mod/forum/user.php', $baseargs),
|
||||
);
|
||||
$forumtab->add(
|
||||
get_string('discussions', 'forum'),
|
||||
new moodle_url('/mod/forum/user.php',
|
||||
array_merge($baseargs, ['mode' => 'discussions']),
|
||||
),
|
||||
);
|
||||
|
||||
// We add the forum link either immediately after the 'viewuserdetails' link, or as the first item in the list.
|
||||
foreach ($usernode->children as $child) {
|
||||
if ($child->key === 'viewuserdetails') {
|
||||
continue;
|
||||
}
|
||||
$addbefore = $child;
|
||||
break;
|
||||
}
|
||||
$usernode->add_node($forumtab, $addbefore->key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2024042200; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2024082100; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2024041600; // Requires this Moodle version.
|
||||
$plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue