Anonymous posting mode


(WinRAR) #1

Could we get the anonymous posting mode turned on (preferably on certain “categories”), if the forum administrator decides to?

Or at least, allowing logged in members to post anonymously (forum administrators can still ban that username, but the post will appear as anonymous to every other members).

That’d be sweet.


Plugin that allows anonymous posting
How to balance confidentiality with openness in Discourse configuration
Can staff be able to see real author of anonymous posts
(Jeff Atwood) #2

This is of course already possible, just create another account using whatever credentials you like.

Given that there is already a way to do this, it doesn’t seem particularly urgent, though I can understand where certain forums discussing sensitive material might want it, but for forums like that, I expect folks would generally be anonymous from the get-go when they created their original account…


(WinRAR) #3

Thanks for the reply, @codinghorror. It’s definitely possible that there are people who would register random nicknames just to do that.

However, there are several things that a true “anon” mode would allow that a fake nickname would not:

0, The ability to tell how many people are participating in a topic. There are communities like the one that I’m an administrator of, there might be truly humorous and interesting topics that are mostly one person contributing but playing roles of 3-4 people debating about one particular problem. And that is not even the *chan community. Register 3-4 nicknames for just a topic is probably not someone would do, but posting as 3-4 different personalities as anon is something that some people would do.

1, The ability to post without logging in or with the hassle of registering a nickname. With some system, encouraging posting without logging in is a legitimate need.

So hopefully these could be something that you guys are considering adding, as random nicknames, while useful, would not be able to cut it.

PS: It’s not urgent though. Helping user bases to convert their current software or at least userbase is probably the most demanding need right now. Hopefully you guys are delivering it in 6-8 weeks… :slight_smile:


(Erlend Sogge Heggen) #5

I think registration-free posting is very valuable. There are hundreds of blogs out there that would have never had a comment from me if they required registration to comment. Likewise, I would not comment on your blog posts as they are now, if I was just passing by.

I know many developers who never made contact with projects that could have been of great use to them (and them to the project) because they couldn’t be bothered to sign up just to say hello / share their code / announce their project / make their inquiry.

Personally, I’d employ anonymous posting in the ‘feedback’ and ‘promotion’ sections of my forum, as that’s the kind of user made content that should be as unencumbered by “paperwork” as possible.


(stance455) #6

Im sort of on the fence with this but with easy sign up processes along with twitter/FB logins… Im leaning towards a no on “anon mode”

If you dont want to sign up and register I feel like theres a higher likelihood your comment/topic is of low quality and you weren’t looking to stay informed on the topic ( receive replies /subscribe etc )


(Marek Kowalcze) #7

@codinghorror, I’m also interested in truly “anon mode” option which does not require registration. Is there any plans to support it in any way soon? This is perfectly reasonable feature for some forums I guess.

@winr0ar, did you manage to accomplish this somehow?


(pkustl) #8

@codinghorror , I think Discourse is a wonderful application. Thank you for making this happen! I am an administrator from a university forum. And I found that if a user can post their thoughts, complaints anonymously, this function can encourage more frank discussion. Also, I think it is important to achieve a Civilized Communication, which is also the vision of Discourse.


(Jeff Atwood) #9

I think it can be a very dangerous thing.

That said, it is probably fine as a plugin.


(pkustl) #10

Dear @codinghorror , how is everything recently? We have employed the Discourse in our university BBS and we all love it very much.

Is it still possible for us to develop a function or plugin for Discourse to realize a real anonymous mode discussion? More and more students are requiring this function so that they can fully open mind to be involved in sensitive discussion.

I fully embrace your vision to create a civilized community through Discourse. Some discussion, especially concern about politics or some other authority-unfavorable speech, a real anonymous mode will greatly encourage civilized students to be involved in, especially when a school or company will assign a username for each member and make your suggestion which is registering another username not workable.

Merry Christmas and happy new year.


(Jeff Atwood) #11

It is not high on our list, but there is nothing stopping anyone from contributing an anonymous posting feature.

I would like to see some examples of traditional forums where users regularly dip into an anonymous mode rather than signing up with an anonymous account to start with, because I am not familiar with any examples of this on the Internet today.


(Alexander) #12

Like Slashdot’s “Anonymous Coward” checkbox?


(pkustl) #13

Thank you, @codinghorror . There is a very famous forum application named: Discuz. This forum can activate the “Anonymous Posting Mode.” An section manager only needs to check “Anonymous Posting” under relevant section, then all posts posted under this section will be anonymous.
The need for this function is becoming especially necessary in China because of the intensive survillance of forums by the government and also low level of free speech makes people feel hesitant to speak online. And they prefer to speak what they think in an anonymous mode.
I am totally a newbie in this area, but please seriously consider this option. Thanks.


(Ekenheim) #14

I’d love this feature aswell.
Similar to the one provided at Coursera.org when asking questions in anonymous fashion…


(Dave Mackey) #15

In my case, I’m setting up a forum for local ministers. In general I want the ministers to be aware of each other’s identities, as the forum is mean to facilitate cooperation between ministers…but, I’d also like people to have the option to post to certain forums anonymously if they desired…

There is no open registration on the forum (it is for a specific geographic locale only)…so I would have to setup both their regular account and an anonymous account…

Practical use scenarios would include the following:

  • A minister is struggling with a difficult congregant, but desires to keep the congregants identity anonymous while simultaneously asking for advice on how to best interact with this congregant…especially since some of us lead small churches, if the church is revealed (by the minister being revealed) then it would be a fairly easy process of deduction to determine the difficult individual.
  • A minister has had a moral failure of some sort and is struggling with what to do now. This minister might be unwilling to admit such a fault with his name attached, but willing to do so anonymously, and while he could remain anonymous, it is likely that the discussion will facilitate proper action on his part, if needed, regarding that failure.
  • To provide ministers with a way to share that they are struggling in some specific area and desire prayer or advice or are looking for a mentor, etc.

Ideally, these sort of sensitive conversations occur in-person…but ministers are notoriously isolated individuals…My goal is to facilitate deeper and more relationships between ministers to support one another, but until that happens, I would like to offer at least some form of support to those who are struggling in the above or other areas.

This isn’t an absolute must for me…I’m starting the forum w/out it, I just thought it might be helpful to give a concrete example besides that given by @pkustl.


(Jeff Atwood) #16

I agree that this is a reasonable request, useful for a lot of communities, and it is on my list of things I want to get to in the next 12 months.


Post comment as anonymous?
(Benjamin Kampmann) #17

If there is interest in it, I just build this for a project of mine. The patch hasn’t been done against vanilla, nor against the latest version of DC but it might work and is most def a good basis to get started. It still misses a feature to allow to configure who can post anonymously as well as the possibility to see the private posts author for staff members.

commit 3470a01b2d6d7f066874c78ac17de669477af5a8
Author: Benjamin Kampmann <ben.kampmann@gmail.com>
Date:   Sun Oct 26 20:35:56 2014 -0600

    add facility for private posting

diff --git a/app/assets/javascripts/discourse/models/_post.js b/app/assets/javascripts/discourse/models/_post.js
index 6356e6d..71b2f50 100644
--- a/app/assets/javascripts/discourse/models/_post.js
+++ b/app/assets/javascripts/discourse/models/_post.js
@@ -152,6 +152,7 @@ Discourse.Post = Discourse.Model.extend({
         reply_to_post_number: this.get('reply_to_post_number'),
         category: this.get('category'),
         archetype: this.get('archetype'),
+        post_privately: this.get('post_privately'),
         title: this.get('title'),
         image_sizes: this.get('imageSizes'),
         target_usernames: this.get('target_usernames'),
diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js
index 9cee7aa..b8c3647 100644
--- a/app/assets/javascripts/discourse/models/composer.js
+++ b/app/assets/javascripts/discourse/models/composer.js
@@ -497,6 +497,7 @@ Discourse.Composer = Discourse.Model.extend({
       imageSizes: opts.imageSizes,
       cooked: this.getCookedHtml(),
       reply_count: 0,
+      post_privately: this.get('post_privately'),
       display_username: currentUser.get('name'),
       username: currentUser.get('username'),
       user_id: currentUser.get('id'),
diff --git a/app/assets/javascripts/discourse/templates/composer.js.handlebars b/app/assets/javascripts/discourse/templates/composer.js.handlebars
index 3de90e7..73d3d0f 100644
--- a/app/assets/javascripts/discourse/templates/composer.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/composer.js.handlebars
@@ -39,6 +39,9 @@
             {{else}}
               <a {{action displayEditReason}} class="display-edit-reason">{{i18n composer.show_edit_reason}}</a>
             {{/if}}
+          {{else}}
+            {{input type="checkbox" checked=model.post_privately}}
+            {{i18n post_privately}}
           {{/if}}
         </div>
 
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index 27ec03e..52092bc 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -322,6 +322,7 @@ class PostsController < ApplicationController
     permitted = [
       :raw,
       :topic_id,
+      :post_privately,
       :title,
       :archetype,
       :category,
diff --git a/app/models/post.rb b/app/models/post.rb
index 37307ce..ccc942f 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -25,6 +25,7 @@ class Post < ActiveRecord::Base
   belongs_to :topic, counter_cache: :posts_count
 
   belongs_to :reply_to_user, class_name: "User"
+  belongs_to :private_author, class_name: "User"
 
   has_many :post_replies
   has_many :replies, through: :post_replies
@@ -601,6 +602,8 @@ end
 #  hidden_at               :datetime
 #  self_edits              :integer          default(0), not null
 #  reply_quoted            :boolean          default(FALSE), not null
+#  is_private_post         :boolean          default(FALSE)
+#  private_author_id       :integer
 #
 # Indexes
 #
diff --git a/app/serializers/post_serializer.rb b/app/serializers/post_serializer.rb
index a7d546e..774ed94 100644
--- a/app/serializers/post_serializer.rb
+++ b/app/serializers/post_serializer.rb
@@ -46,10 +46,12 @@ class PostSerializer < BasicPostSerializer
              :deleted_at,
              :deleted_by,
              :user_deleted,
+             :private_author,
              :edit_reason,
              :can_view_edit_history,
              :wiki,
              :user_custom_fields,
+             :is_private_post,
              :static_doc
 
   def moderator?
@@ -145,6 +147,15 @@ class PostSerializer < BasicPostSerializer
     scope.is_staff? && object.deleted_by.present?
   end
 
+  def private_author
+    BasicUserSerializer.new(object.private_author, root: false).as_json
+  end
+
+  def include_private_author?
+    scope.is_staff? && object.private_author.present?
+  end
+
+
   # Summary of the actions taken on this post
   def actions_summary
     result = []
diff --git a/db/migrate/20141027012646_add_is_anonym_to_post.rb b/db/migrate/20141027012646_add_is_anonym_to_post.rb
new file mode 100644
index 0000000..68146b2
--- /dev/null
+++ b/db/migrate/20141027012646_add_is_anonym_to_post.rb
@@ -0,0 +1,6 @@
+class AddIsAnonymToPost < ActiveRecord::Migration
+  def change
+    add_column :posts, :is_private_post, :bool, default: false
+    add_column :posts, :private_author_id, :integer
+  end
+end
diff --git a/lib/guardian.rb b/lib/guardian.rb
index 838e632..830611f 100644
--- a/lib/guardian.rb
+++ b/lib/guardian.rb
@@ -102,6 +102,10 @@ class Guardian
     can_do?(:delete, obj)
   end
 
+  def can_post_privately?()
+    return true
+  end
+
   def can_moderate?(obj)
     obj && authenticated? && (is_staff? || (obj.is_a?(Topic) && @user.has_trust_level?(:elder)))
   end
diff --git a/lib/post_creator.rb b/lib/post_creator.rb
index a0145bb..8e099de 100644
--- a/lib/post_creator.rb
+++ b/lib/post_creator.rb
@@ -40,6 +40,13 @@ class PostCreator
     @user = user
     @opts = opts || {}
     @spam = false
+    @private_author = nil
+    if opts[:post_privately]
+      if guardian.can_post_privately?
+        @private_author = @user
+        @user = Discourse.system_user
+      end
+    end
   end
 
   # True if the post was considered spam
@@ -74,7 +81,7 @@ class PostCreator
       store_unique_post_key
       track_topic
       update_topic_stats
-      update_user_counts
+      update_user_counts if !@opts[:post_privately]
       create_embedded_topic
 
       ensure_in_allowed_users if guardian.is_staff?
@@ -207,6 +214,7 @@ class PostCreator
 
     post = @topic.posts.new(raw: @opts[:raw],
                             user: @user,
+                            is_private_post: @opts[:post_privately],
                             reply_to_post_number: @opts[:reply_to_post_number])
 
     # Attributes we pass through to the post instance if present
@@ -214,6 +222,8 @@ class PostCreator
       post.send("#{a}=", @opts[a]) if @opts[a].present?
     end
 
+    post.private_author = @private_author if @opts[:post_privately]
+
     post.extract_quoted_post_numbers
     post.created_at = Time.zone.parse(@opts[:created_at].to_s) if @opts[:created_at].present?
 
@@ -288,7 +298,15 @@ class PostCreator
   def track_topic
     return if @opts[:auto_track] == false
 
-    TopicUser.change(@post.user.id,
+    user_id = begin
+      if @private_author
+        @private_author.id
+      else
+        @user.id
+      end
+    end
+
+    TopicUser.change(user_id,
                      @post.topic.id,
                      posted: true,
                      last_read_post_number: @post.post_number,
@@ -297,12 +315,12 @@ class PostCreator
 
     # assume it took us 5 seconds of reading time to make a post
     PostTiming.record_timing(topic_id: @post.topic_id,
-                             user_id: @post.user_id,
+                             user_id: user_id,
                              post_number: @post.post_number,
                              msecs: 5000)
 
 
-    TopicUser.auto_track(@user.id, @topic.id, TopicUser.notification_reasons[:created_post])
+    TopicUser.auto_track(user_id, @topic.id, TopicUser.notification_reasons[:created_post])
   end
 
   def enqueue_jobs


(Jacob) #18

I’m very excited for this feature. I’m hoping there will be an option for an anonymous only category.

The following example is great. Everyone is assigned Human and a number. Everyone gets randomly selected animals for their avatars.


Using discourse as a community ticket system
(Sam Saffron) #20

Let’s keep all discussion here:


(Sam Saffron) #21