Moodle

blog entries (only those posted by users who are assigned any role in system context), are visible in all courses irrespective of participation, despite course bloglevel setting.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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.

Activity

Hide
Robert Levy added a comment -

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').

Show
Robert Levy added a comment - 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').
Hide
Robert Levy added a comment -

I have attached a patch blog/lib.php (not the latest version, this is for Moodle version 1.8.5, and the version of file itself in that release is labeled "1.62.2.6 2007/08/17 08:15:38 toyomoyo").

This is just a one-line change, so that instead of including users who are assigned a role in a context above that of the specific course instance, it will only include users who are actually assigned the role for the specific course instance context. That makes it show only posts by participants in the course.

The previous way, it would show posts for any user who was assigned any system-level role.

Show
Robert Levy added a comment - I have attached a patch blog/lib.php (not the latest version, this is for Moodle version 1.8.5, and the version of file itself in that release is labeled "1.62.2.6 2007/08/17 08:15:38 toyomoyo"). This is just a one-line change, so that instead of including users who are assigned a role in a context above that of the specific course instance, it will only include users who are actually assigned the role for the specific course instance context. That makes it show only posts by participants in the course. The previous way, it would show posts for any user who was assigned any system-level role.
Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Michael de Raadt added a comment -

I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: