Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Anonymous Users

From MoodleDocs

Are you sure it should be a user_alias_course table? The other option would be to do user_alias_context, which would be more flexible. Not sure if you need the flexibility, but increasingly in Moodle things are being linked to contexts.

Good point Tim. I played with the code and it actually is a lot easier than I imagined, mostly thanks to seeing the code you did for the filters. Overall I think it does give maximum fexibility so will approach it this way. --Shane Elliott 09:41, 1 May 2010 (UTC)

Forum table changes

Spec doesn't seem to mention the necessary changes to forum tables; forum_posts needs an 'anonymous' field, at least.

Also I didn't really understand how to implement support for this in a module. For instance I guess I could define FEATURE_ANONYMOUS in my module _supports function and then it would automatically add the option to the mod_form for me, but it doesn't say that.

Then should the anonymous option for that module be stored in course_modules? (I see the desire to do it with context but there is no standard UI for editing things in different contexts and we can't support it across all modules without module changes so there is no point offering it at course level... or is there...)

If it's not in course_modules then as we are going to need it in lots of places potentially, should it be cached in modinfo?

If you don't have permission to view anonymous, but you do have permission to view the 'forum posts' tab on the user profile, then this tab needs to not include anonymous messages...

I think this is probably a lot more difficult (to do properly) than what's already included in the spec. :(

You could code it a bit more easily as a feature specific to forum, though.

Sam marshall 17:56, 14 April 2011 (WST)

Hi! About your first point (adding an ‘anonymous’ column to forum_posts): the way I understand the spec in its current state, I think it’s supposed to take care of that via the tables under DB tables, i. e. if the first one indicates that anonymity is on, the second one is used to fetch an alias for a given user. What I don’t understand yet is how this would work in scenarios like:
  1. A user wants to post anonymously in a forum to ask a question, then post under her own name in the same forum to answer another question.
  2. A user wants to switch between two or more aliases in a role-playing game in a forum, or participate in the RPG while also commenting on it under his real name.
My impression is that, currently, a user would only be able to use one alias (or real name) in a single forum, and that changing the alias would change it for existing posts as well. Am I misunderstanding the idea? Columns to record anonymity or the current alias would work in forum_posts (this is what MDL-1071 does), but then the forum module, or any other module with anonymity support, will need at least to pass the desired alias explicitly to fullname() (and also to the user picture code), which seems to go against the idea of the spec. --Ewgenij Starostin 17:45, 2 May 2011 (WST)


Sam is correct; forum_posts needs an 'anonymous' field, so that users can select whether individual posts are anonymous within the same forum. Other individual modules may need to perform special handling for anonymity.
MDL-1071 has a patch that adds anonymity to forum posts, and there is discussion about various places where identity information can be leaked. --Hubert Chathi 00:01, 12 July 2011 (WST)