effective_learndash 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/app/controllers/admin/learndash_users_controller.rb +8 -0
- data/app/models/effective/learndash_api.rb +11 -0
- data/app/models/effective/learndash_user.rb +6 -0
- data/app/views/admin/learndash_users/_form.html.haml +13 -3
- data/app/views/admin/learndash_users/_learndash_user.html.haml +8 -2
- data/lib/effective_learndash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c988c1953adabbfc3e8bac44c28a11575423e93ffcd216e76c70c8a7045be09
|
4
|
+
data.tar.gz: db782e5f5971a1098d3f5268e3218c34341f567971d8159c9a3e431a06f612c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 577324f8a74fbc1622327c97e83efef53bb67aaaf2e506805ac697b25be8ad43a197a6b373d33c1061f0f81ea6526d9123c5e4a7e4eb89ebc44a3a21725c3ada
|
7
|
+
data.tar.gz: ca4487a5aec94110d60ec5872d1806d96b1c3ef3fa0111c4c65ab7d6c914ae63008c5fcb44e472485b1548bdd033a1080757926d71b9024534827927e2d8b6d2
|
data/README.md
CHANGED
@@ -115,6 +115,12 @@ There are no webhooks or callbacks from LearnDash, everything is a GET request t
|
|
115
115
|
|
116
116
|
You can refresh an entire LearnDash user in one operation and it will sync the entire user at once, `user.learndash_user.refresh!`
|
117
117
|
|
118
|
+
## Delete User
|
119
|
+
|
120
|
+
If you need to delete a user, from wordpress:
|
121
|
+
|
122
|
+
1. Top Left Corner -> My Sites -> Network Admin -> Users
|
123
|
+
|
118
124
|
## License
|
119
125
|
|
120
126
|
MIT License. Copyright [Code and Effect Inc.](http://www.codeandeffect.com/)
|
@@ -7,5 +7,13 @@ module Admin
|
|
7
7
|
|
8
8
|
on :refresh, success: -> { "Successfully refreshed #{resource} and all course enrollments" }
|
9
9
|
|
10
|
+
submit :update_password, 'Update Password'
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def permitted_params
|
15
|
+
params.require(:effective_learndash_user).permit!
|
16
|
+
end
|
17
|
+
|
10
18
|
end
|
11
19
|
end
|
@@ -52,6 +52,17 @@ module Effective
|
|
52
52
|
nil
|
53
53
|
end
|
54
54
|
|
55
|
+
def update_password(owner, password)
|
56
|
+
raise('expected a leardash owner') unless owner.class.respond_to?(:effective_learndash_owner?)
|
57
|
+
raise('expected an existing learndash user') unless owner.learndash_user&.persisted?
|
58
|
+
raise('expected a password') unless password.present?
|
59
|
+
|
60
|
+
user = user_id(owner) || raise('expected a user')
|
61
|
+
payload = { password: password }
|
62
|
+
|
63
|
+
post("/wp/v2/users/#{user}", payload.stringify_keys)
|
64
|
+
end
|
65
|
+
|
55
66
|
# Create User
|
56
67
|
# Usernames can only contain lowercase letters (a-z) and numbers.
|
57
68
|
def create_user(owner)
|
@@ -1,6 +1,16 @@
|
|
1
1
|
= effective_form_with(model: [:admin, learndash_user], engine: true) do |f|
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
- if f.object.new_record?
|
4
|
+
= f.select :owner, {'Owners' => current_user.class.sorted }, polymorphic: true,
|
5
|
+
hint: 'Create a LearnDash account for this user'
|
5
6
|
|
6
|
-
|
7
|
+
= f.submit
|
8
|
+
|
9
|
+
- if f.object.persisted?
|
10
|
+
= f.text_field :password, label: 'New Password',
|
11
|
+
value: EffectiveLearndash.wp_password_for(learndash_user.owner)
|
12
|
+
|
13
|
+
%p.text-muted
|
14
|
+
This action will also update the LearnDash LMS wordpress user account password.
|
15
|
+
|
16
|
+
= f.submit 'Update Password'
|
@@ -3,12 +3,18 @@
|
|
3
3
|
= link_to(learndash_user.owner, "/admin/users/#{learndash_user.owner.to_param}/edit")
|
4
4
|
has an existing account on LearnDash.
|
5
5
|
|
6
|
+
%p= link_to "LearnDash LMS User Admin", EffectiveLearndash.learndash_url.chomp('/') + "/wp-admin/user-edit.php?user_id=#{learndash_user.user_id}", target: '_blank'
|
7
|
+
|
6
8
|
%ul
|
7
9
|
%li Email: #{learndash_user.email}
|
8
10
|
%li Username: #{learndash_user.username}
|
9
|
-
%li
|
11
|
+
%li
|
10
12
|
|
11
|
-
|
13
|
+
Password: #{learndash_user.password}
|
14
|
+
|
15
|
+
= collapse('change password', card_class: 'my-2') do
|
16
|
+
.row
|
17
|
+
.col-lg-4= render('admin/learndash_users/form', learndash_user: learndash_user)
|
12
18
|
|
13
19
|
%p
|
14
20
|
%small Last refreshed #{time_ago_in_words(learndash_user.last_synced_at)} ago.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_learndash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|