Canapin
(Coin-coin le Canapin)
12월 7, 2022, 11:33오후
12
사용자가 몇 명이나 있나요?
처음부터 다시 시작해야 한다면, 대안으로 data explorer 를 사용하여 사용자의 이메일 주소를 CSV 파일로 내보내고, 포럼을 다시 만든 후 해당 CSV 파일을 통해 사용자를 일괄 초대하는 방법을 사용할 수 있습니다.
또 다른 아이디어도 있습니다. 더 어렵고, 제 생각에는 작동하지 않을 수도 있어서 확신은 없습니다.
data-explorer를 사용하여 유지하고 싶은 사용자 데이터를 모두 내보냅니다(아바타는 유지하고 싶지 않으므로, 다른 정보도 건너뛸 수 있습니다) 그리고 결과를 파일로 내보냅니다.
그 후, 새 포럼을 설치한 뒤 파일을 파싱하여 데이터베이스에 사용자 항목(옵션, 이메일 등)을 생성하는 rails 스크립트를 작성합니다.
rails 콘솔에서 사용자를 생성하는 예시는 다음과 같습니다:
I do have a question about email notifications using this method.
I have added users through the console using the following commands:
u = User.create!(username: ‘xx’, email: ‘xx@xx.com’, password: ‘xxx’, mailing_list_mode: ‘true’);u.approve(Discourse.system_user, false) ; u.activate
I have enabled “Send all new users a welcome message with a quick start guide” in http://forum.brickfield.org.uk/admin/site_settings/category/uncategorized
However, emails are not being sent to users being add…
여기서 찾은 또 다른 스크립트입니다: https://meta.discourse.org/t/import-users-from-csv/79203:
import_users_from_csv.rb
require 'csv'
namespace :user_importer do
desc "Import users from a CSV file"
task :import, [:csv_file] => [:environment] do |_, args|
abort "Please specify the CSV file to import" if args[:csv_file].blank?
CSV.foreach(args[:csv_file], col_sep: ';', headers: true) do |new_user|
user = User.find_by_email(new_user['email'])
if user
This file has been truncated. show original
이 스크립트는 특정 시점에서 작동하지 않습니다(그래서 Support 카테고리에 있는 것입니다 ), 하지만 여전히 흥미로운 정보를 포함하고 있을 수 있습니다.