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?
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?