Creating a gender limited forum?

AI-generated summary

The discussion revolves around creating a gender-limited forum for women using Discourse. ericskiff seeks to restrict access to Facebook signups and use gender data from Facebook to automatically assign users to a ‘female’ group. vinothkannans provides a code snippet to achieve this by hooking into the FacebookUserInfo model and adding users to a group based on gender. They also suggest limiting categories to the ‘female’ group. ericskiff expresses gratitude for the detailed assistance. pfaffman clarifies that custom plugins require enterprise hosting, offering self-hosting services. 8BIT praises pfaffman for his expertise.

I’m working with a entrepreneur to create a women’s only discourse forum. I’ve explored custom fields and have a gender option present during signup, but the ideal for this particular forum would be to only allow facebook signups and to pull gender from there.

I’m a rails developer so this seems accomplishable in abstract, but I’m not sure if the discourse plugin system has hooks into the Facebook login flow. Would something like this be possible? Where’s the best place to start learning about what plugins can and cant do?

You can find resources related to the plugin development here in Search results for '#howto plugin development' - Discourse Meta

In Discourse a plugin can do almost anything :sparkles:

Since you are only allowing signups from Facebook it is easier to implement this feature. We already saving gender value in facebook_user_infos table. Similar code like below can work for you (not yet tested)

after_initialize do

  FacebookUserInfo.class_eval do

    after_commit : add_to_gender_group, on: :create

    def add_to_gender_group
      return if gender.blank?

      group = Group.find_by name: gender.downcase
      group.add user
    end

  end

end

And you can limit all your categories only for “female” group.

Oh my gosh. This is beyond amazing. Years working on wordpress, and hundreds of integrations with APIs in rails, and I’ve never gotten “here’s what you need on a platter” assistance like this. You’re the best!

If I develop this plugin, can I use it on the official hosted discourse, or will I need to host my own?

Custom plugins require enterprise hosting. If you’d like help with self hosting, that’s what I do: Redirecting…

@pfaffman is one of the best.