When you do 'show readers' it currently shows everyone who has read a post. We
need to change it to include only people who belong to certain roles.
1) The role list (config setting) we will use already exists; it is called
forumng_monitorroles. Look on forum settings screen to see it. Please change
the text description slightly so that it explains it is also used for the show
2) Show readers is somewhere like, mod/forumng/feature/showreaders or so. For
assistance finding your way around forum code, try Ray or Mahmoud.
3) Logic is as follows (this should be incorporated into the existing query -
please don't make it do one-query-per-reader as there could be hundreds):
a) Get the list of current contexts from $context->contextpath or somesuch (has
a comma-separated list of context ids for forum, course, all contexts above
b) in the query, find out if somebody is in the role by doing an INNER JOIN
(beware of duplicate results if somebody has two roles that are both on the
list) or WHERE (SELECT) subquery, which basically tries to find an entry in
role_assignments for the user in question, where roleid IN (the list from
config) and contextid IN (the list from the contextpath). Obviously, make the
query only include people who meet this requirement.
c) To reiterate, make sure to test with:
i. a user account that isn't in any of the selected roles
ii. one who's in more than one of the selected roles
4) If there is help for this function, or on-screen text [I can't remember],
please modify it slightly so that it uses words like 'relevant users' or
something rather than indicating that it includes all people who see the