Module: WpWrapper::Modules::Profiles

Included in:
Client
Defined in:
lib/wp_wrapper/modules/profiles.rb

Instance Method Summary collapse

Instance Method Details

#add_user(login, email, password, role = :editor, send_password = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/wp_wrapper/modules/profiles.rb', line 5

def add_user(, email, password, role = :editor, send_password = false)
  options   =   {
    :user_login     =>  {:value   => ,         :type => :input}, 
    :email          =>  {:value   => email,         :type => :input},
    :pass1          =>  {:value   => password,      :type => :input},
    :pass2          =>  {:value   => password,      :type => :input},
    :role           =>  {:value   => role,          :type => :select},
    :send_password  =>  {:checked => send_password, :type => :checkbox},
  }

  url       =   get_url(:new_user, absolute: false, admin_prefix: '')

  return set_options_and_submit(url, {name: "createuser"}, options)
end

#change_display_name(display_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/wp_wrapper/modules/profiles.rb', line 20

def change_display_name(display_name)
  options   =   {
    :nickname         =>    {:value => display_name, :type => :input}
  }
  
  update_profile(options)

  options   =   {
    :display_name     =>    {:value => display_name, :type => :select}
  }
  
  update_profile(options)
end

#change_profile_password(new_password) ⇒ Object

Deprec?



50
51
52
53
54
55
56
57
# File 'lib/wp_wrapper/modules/profiles.rb', line 50

def change_profile_password
  options   =   {
    :pass1    =>  {:value => new_password, :type => :input}, 
    :pass2    =>  {:value => new_password, :type => :input}
  }

  return update_profile(options)
end

#update_profile(options = {}) ⇒ Object



43
44
45
46
47
# File 'lib/wp_wrapper/modules/profiles.rb', line 43

def update_profile(options = {})
  url       =   get_url(:profile, absolute: false, admin_prefix: '')

  return set_options_and_submit(url, {action: /profile\.php/i}, options)
end