Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 27 lines (20 sloc) 0.819 kB
def update_users
users = WpUser.find(:all, :conditions => "user_login != '' and user_login != 'admin'")
agent = WWW::Mechanize.new
page = agent.get("#{$base_url}/wp-login.php/")
login_form = page.form('loginform')
login_form.log = $wordpress_username
login_form.pwd = $wordpress_password
page = agent.submit(login_form)
users.each do |user|
page = agent.get("#{$base_url}/wp-admin/user-edit.php?user_id=#{user.id}")
user_form = page.forms[0]
if ((user_form.email == "" or user_form.email.nil?) and user_form.role == 'subscriber')
user_form.role = 'author'
user_form.email = 'change@no_domain.com'
user_form.pass1 = 'change_this_password'
user_form.pass2 = 'change_this_password'
page = agent.submit(user_form)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.