# Load the Discourse environment require File.expand_path("../../../config/environment", __FILE__) # require_relative '/var/www/discourse/config/environment' def set_md5_password_custom_field(username, md5_password) user = User.find_by(username: username) if user user.custom_fields['custom_password_md5'] = md5_password user.save! puts "MD5 password custom field set for user: #{username}" else puts "User not found: #{username}" end end # Replace 'username' and 'md5_password_hash' with actual values username = 'davidpaulyoung' md5_password_hash = '$GT$i5ZNZdfX$077FK6JU70HIr2pR1/uLP1' # md5_password_hash = 'i5ZNZdfX$077FK6JU70HIr2pR1/uLP1' set_md5_password_custom_field(username, md5_password_hash)