Moodle

Separate Groups wiki does not work for Student type

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.4
  • Fix Version/s: None
  • Component/s: Wiki (1.x)
  • Labels:
    None
  • Environment:
    Moodle 1.9.4+ (Build: 20090508)
  • Affected Branches:
    MOODLE_19_STABLE

Description

If wiki is set to Student type and Separate Groups mode it is working as Student/No Groups, so entries made by the group members are not visible to fellow group participants (students can see only their own wikis).

Activity

Hide
Neil Streeter added a comment -

We're seeing this issue too with 1.95 - The problem arises from wiki/lib.php...

In the function:
wiki_get_other_wikis...

around line 660 we have:
if (($groupmode == VISIBLEGROUPS) or wiki_is_teacheredit($wiki)) { $viewall = true; }
else if ($groupmode == SEPARATEGROUPS) { $viewall = mygroupid($course->id); }
else { $viewall = false; }

Part of the issue is that $viewall is boolean in most cases and an array when SEPARATEGROUPS is used because mygroupid returns an array.

Then later - around line 689 there exists:
if (($viewall === true) or groups_is_member($viewall, $wiki_entry->userid)) {
$key = 'view.php?id='.$id.'&userid='.$wiki_entry->userid.'&page='.$wiki_entry->pagename;
$wikis[$key] = fullname($wiki_entry).':'.$wiki_entry->pagename;
if ($currentid == $wiki_entry->id) {

Here lies the other part of the issue....
groups_is_member takes an int not an array and thus the 'if' expression never evaluates to 'true' when using separate groups. As a result the 'wikis' array remains empty and the dropdown allowing students the ability to navigate between group member wikis is never presented - thus it acts as if 'no groups' was set.

I'm looking at the best method for fixing this but this particular function is a bit hairy so I'm thinking it might need quite a lot of work to get it right. Any help is appreciated.

Thanks!
ns

Show
Neil Streeter added a comment - We're seeing this issue too with 1.95 - The problem arises from wiki/lib.php... In the function: wiki_get_other_wikis... around line 660 we have: if (($groupmode == VISIBLEGROUPS) or wiki_is_teacheredit($wiki)) { $viewall = true; } else if ($groupmode == SEPARATEGROUPS) { $viewall = mygroupid($course->id); } else { $viewall = false; } Part of the issue is that $viewall is boolean in most cases and an array when SEPARATEGROUPS is used because mygroupid returns an array. Then later - around line 689 there exists: if (($viewall === true) or groups_is_member($viewall, $wiki_entry->userid)) { $key = 'view.php?id='.$id.'&userid='.$wiki_entry->userid.'&page='.$wiki_entry->pagename; $wikis[$key] = fullname($wiki_entry).':'.$wiki_entry->pagename; if ($currentid == $wiki_entry->id) { Here lies the other part of the issue.... groups_is_member takes an int not an array and thus the 'if' expression never evaluates to 'true' when using separate groups. As a result the 'wikis' array remains empty and the dropdown allowing students the ability to navigate between group member wikis is never presented - thus it acts as if 'no groups' was set. I'm looking at the best method for fixing this but this particular function is a bit hairy so I'm thinking it might need quite a lot of work to get it right. Any help is appreciated. Thanks! ns
Hide
Martin Gertsch added a comment -

My hack in function groups_is_member:

function groups_is_member($groupid, $userid=null) {
global $USER;

if (!$userid) { $userid = $USER->id; }
/// moodleswiss
foreach ($groupid as $groupid_entry) {
if (record_exists('groups_members', 'groupid', $groupid_entry, 'userid', $userid)) { return true; }
}

return record_exists('groups_members', 'groupid', $groupid, 'userid', $userid);
}

Now it works.

Martin Gertsch

Show
Martin Gertsch added a comment - My hack in function groups_is_member: function groups_is_member($groupid, $userid=null) { global $USER; if (!$userid) { $userid = $USER->id; } /// moodleswiss foreach ($groupid as $groupid_entry) { if (record_exists('groups_members', 'groupid', $groupid_entry, 'userid', $userid)) { return true; } } return record_exists('groups_members', 'groupid', $groupid, 'userid', $userid); } Now it works. Martin Gertsch

People

Dates

  • Created:
    Updated: