Hilfe beim Design eines benutzerdefinierten Integrations-Plugins

Once you have their Codeforces handle in a user_custom_field then it should be easy enough to update whatever stuff you want from their profile (assign groups, stick whatever profile data from codeforces into user custom fields, and so on) when they log in.

Something like:

after_initialize do
  DiscourseEvent.on(:user_logged_in) do |user|
    # get stuff from codeforce
      if codeforce_rating > 1400
          group = Group.find_by(name: group_1400)
          if group
            gu = GroupUser.find_by(group_id: group.id, user_id: user.id)
            GroupUser.create(group_id: group.id, user_id: user.id) unless gu
          end
        end
      end

  end

end

This way is really easy and you’d update data only for people who are actually active in the community.

4 „Gefällt mir“