Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.8.5
-
Fix Version/s: None
-
Component/s: Blog, Course, Roles / Access
-
Labels:None
-
Environment:Linux/Apache
-
Database:MySQL
-
Affected Branches:MOODLE_18_STABLE
Description
The bloglevel setting does not work as it should, but only under certain conditions. The expected/intended behavior of the bloglevel being 'course' is that only the blog entries of users participating in a given course will show in the blog_menu block's "view course entries".
If users are assigned various roles (student, grading TA etc) only in the context of courses, then the "view course entries" functionality observes the bloglevel rule correctly.
However, when I assign a user any role in the system context (it doesn't matter what role), that one user's blog entries will appear in all courses, when viewing blog entries in blog_menu under view course entries. Other users' entries will continue to observe the policy of the bloglevel setting.
The bug depends only the user having a system-level role. It even happens when a system level role is assigned where all of the capabilities have the permission of "not set."
Thanks in advance for any pointers, ideas, solutions.
Edit: the source of the problem is in blog/lib.php in the fetch_entries function, in the sql for showing entries by group. It seems that while the bloglevel setting suggests that blogs should be filtered to show only entries of course participants when set to course, this has not actually been implemented yet. The bloglevel setting is presently ignored in that part of the code, and the entries shown are those for users who have role assignments in present context (GOOD) as well as user who have role assignments in the contexts above that context (BAD!). This is due to the use of get_related_contexts_string($context). Instead the query should directly test for equality to $context->id. (At least if bloglevel is set to 'course').