New User Approve - Version 1.4

Version Description

  • add filters
  • honor the redirect if there is one set when registering
  • add actions for when a user is approved or denied
  • add a filter to bypass password reset
  • add more translations
  • add user counts by status to dashboard
  • store the users by status in a transient
Download this release

Release Info

Developer picklewagon
Plugin Icon 128x128 New User Approve
Version 1.4
Comparing to
See all releases

Code changes from version 1.3.4 to 1.4

localization/new-user-approve-fi.mo ADDED
Binary file
localization/new-user-approve-fi.po ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Josh Harrison
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: NUA\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
10
+ "POT-Creation-Date: 2009-10-29 08:32+0000\n"
11
+ "PO-Revision-Date: 2012-09-22 11:56+0200\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+
18
+ #: new-user-approve.php:126
19
+ msgid "Approve New Users"
20
+ msgstr "Käyttäjien hyväksyntä"
21
+
22
+ #: new-user-approve.php:140
23
+ msgid "Settings"
24
+ msgstr "Asetukset"
25
+
26
+ #: new-user-approve.php:183
27
+ msgid "Users"
28
+ msgstr "Käyttäjät"
29
+
30
+ #: new-user-approve.php:219
31
+ msgid "User successfully updated."
32
+ msgstr "Käyttäjätiedot päivitetty"
33
+
34
+ #: new-user-approve.php:223
35
+ msgid "User Registration Approval"
36
+ msgstr "Käyttäjien hyväksyntä"
37
+
38
+ #: new-user-approve.php:225
39
+ msgid "User Management"
40
+ msgstr "Käyttäjät"
41
+
42
+ #: new-user-approve.php:228
43
+ msgid "Users Pending Approval"
44
+ msgstr "Hyväksyntää odottavat käyttäjät"
45
+
46
+ #: new-user-approve.php:229
47
+ msgid "Approved Users"
48
+ msgstr "Hyväksytyt käyttäjät"
49
+
50
+ #: new-user-approve.php:230
51
+ msgid "Denied Users"
52
+ msgstr "Hylätyt käyttäjät"
53
+
54
+ #: new-user-approve.php:255
55
+ msgid "ID"
56
+ msgstr "ID"
57
+
58
+ #: new-user-approve.php:256
59
+ msgid "Username"
60
+ msgstr "Käyttäjänimi"
61
+
62
+ #: new-user-approve.php:257
63
+ msgid "Name"
64
+ msgstr "Nimi"
65
+
66
+ #: new-user-approve.php:258
67
+ msgid "E-mail"
68
+ msgstr "Sähköpostiosoite"
69
+
70
+ #: new-user-approve.php:260
71
+ #: new-user-approve.php:262
72
+ msgid "Actions"
73
+ msgstr "Toiminnot"
74
+
75
+ #: new-user-approve.php:296
76
+ msgid "email:"
77
+ msgstr "Sähköpostiosoite:"
78
+
79
+ #: new-user-approve.php:298
80
+ msgid "Approve"
81
+ msgstr "Hyväksy"
82
+
83
+ #: new-user-approve.php:301
84
+ msgid "Deny"
85
+ msgstr "Hylkää"
86
+
87
+ #: new-user-approve.php:313
88
+ msgid "approved"
89
+ msgstr "hyväksytty"
90
+
91
+ #: new-user-approve.php:315
92
+ msgid "denied"
93
+ msgstr "hylätty"
94
+
95
+ #: new-user-approve.php:317
96
+ msgid "pending"
97
+ msgstr "odottaa"
98
+
99
+ #: new-user-approve.php:320
100
+ #, php-format
101
+ msgid "There are no users with a status of %s"
102
+ msgstr "Käyttäjiä, joiden status on %s, ei löytynyt"
103
+
104
+ #: new-user-approve.php:332
105
+ msgid "User name already exists"
106
+ msgstr "Käyttäjätunnus on jo olemassa"
107
+
108
+ #: new-user-approve.php:335
109
+ #, php-format
110
+ msgid "%1$s (%2$s) has requested a username at %3$s"
111
+ msgstr "%1$s (%2$s) pyytää käyttäjätunnusta sivustolle %3$s"
112
+
113
+ #: new-user-approve.php:337
114
+ #, php-format
115
+ msgid "To approve or deny this user access to %s go to"
116
+ msgstr "Salliaksesi tai estääksesi tämän käyttäjän pääsyn kohteeseen %s mene"
117
+
118
+ #: new-user-approve.php:341
119
+ #, php-format
120
+ msgid "[%s] User Approval"
121
+ msgstr "[%s] Käyttäjän hyväksyntä"
122
+
123
+ #: new-user-approve.php:372
124
+ #, php-format
125
+ msgid "You have been approved to access %s"
126
+ msgstr "Sinulle on annettu pääsy kohteeseen %s"
127
+
128
+ #: new-user-approve.php:373
129
+ #, php-format
130
+ msgid "Username: %s"
131
+ msgstr "Käyttäjätunnus: %s"
132
+
133
+ #: new-user-approve.php:374
134
+ #, php-format
135
+ msgid "Password: %s"
136
+ msgstr "Salasana: %s"
137
+
138
+ #: new-user-approve.php:378
139
+ #, php-format
140
+ msgid "[%s] Registration Approved"
141
+ msgstr "[%s] Käyttäjätunnuspyyntö hyväksytty"
142
+
143
+ #: new-user-approve.php:397
144
+ #, php-format
145
+ msgid "You have been denied access to %s"
146
+ msgstr "Pääsysi kohteeseen %s on estetty"
147
+
148
+ #: new-user-approve.php:400
149
+ #, php-format
150
+ msgid "[%s] Registration Denied"
151
+ msgstr "[%s] Käyttäjätunnuspyyntö hylätty"
152
+
153
+ #: new-user-approve.php:413
154
+ msgid "An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request."
155
+ msgstr "Ylläpito tarkastaa tarkastaa lähettämäsi tiedot ja joko hylkää tai hyväksyy pyyntösi."
156
+
157
+ #: new-user-approve.php:414
158
+ msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
159
+ msgstr "Saat ylläpidolta sähköpostitse jatko-ohjeet. Kiitos kärsivällisyydestäsi."
160
+
161
+ #: new-user-approve.php:418
162
+ msgid "Pending Approval"
163
+ msgstr "Odottaa hyväksyntää"
164
+
165
+ #: new-user-approve.php:418
166
+ msgid "Registration successful."
167
+ msgstr "Käyttäjätunnuksen rekisteröinti onnistui."
168
+
169
+ #: new-user-approve.php:466
170
+ #, php-format
171
+ msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
172
+ msgstr "Tervetuloa sivustolle %s. Sivuston käyttö vaatii ylläpidon hyväksymän käyttäjätunnuksen. Aloita luomalla käyttäjätunnus."
173
+
174
+ #: new-user-approve.php:471
175
+ msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
176
+ msgstr "Rekisteröitymisesi välitetään ylläpidolle hyväksyntää varten. Saat sähköpostiisi tiedon, kun ylläpito on hyväksynyt käyttäjätunnuksesi."
177
+
178
+ #. Plugin Name of an extension
179
+ msgid "New User Approve"
180
+ msgstr ""
181
+
182
+ #. Plugin URI of an extension
183
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
184
+ msgstr ""
185
+
186
+ #. Description of an extension
187
+ msgid "This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog."
188
+ msgstr "Tämän lisäosan avulla ylläpitäjät voivat hyväksyä uusien käyttäjien rekisteröinnin."
189
+
190
+ #. Author of an extension
191
+ msgid "Josh Harrison"
192
+ msgstr ""
193
+
194
+ #. Author URI of an extension
195
+ msgid "http://www.picklewagon.com/"
196
+ msgstr ""
197
+
localization/new-user-approve-fr_FR.mo CHANGED
Binary file
localization/new-user-approve-fr_FR.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
  "Project-Id-Version: New User Approve 1.0\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
5
  "POT-Creation-Date: 2009-10-29 08:32+0000\n"
6
- "PO-Revision-Date: 2010-03-09 01:00-0800\n"
7
  "Last-Translator: Josh Harrison <josh@picklewagon.com>\n"
8
  "Language-Team: Philippe Scoffoni <philippe@scoffoni.net>\n"
9
  "MIME-Version: 1.0\n"
@@ -17,7 +17,7 @@ msgstr "Approuver les utilisateurs"
17
 
18
  #: new-user-approve.php:140
19
  msgid "Settings"
20
- msgstr "Paramètres"
21
 
22
  #: new-user-approve.php:183
23
  msgid "Users"
@@ -25,7 +25,7 @@ msgstr "Utilisateurs"
25
 
26
  #: new-user-approve.php:219
27
  msgid "User successfully updated."
28
- msgstr "Utilisateur mis à jour avec succès"
29
 
30
  #: new-user-approve.php:223
31
  msgid "User Registration Approval"
@@ -41,11 +41,11 @@ msgstr "Utilisateurs en attente d'approbation"
41
 
42
  #: new-user-approve.php:229
43
  msgid "Approved Users"
44
- msgstr "Utilisateurs approuvés"
45
 
46
  #: new-user-approve.php:230
47
  msgid "Denied Users"
48
- msgstr "Utilisateurs refusés"
49
 
50
  #: new-user-approve.php:255
51
  msgid "ID"
@@ -82,11 +82,11 @@ msgstr "Refuser"
82
 
83
  #: new-user-approve.php:313
84
  msgid "approved"
85
- msgstr "approuvé"
86
 
87
  #: new-user-approve.php:315
88
  msgid "denied"
89
- msgstr "refusé"
90
 
91
  #: new-user-approve.php:317
92
  msgid "pending"
@@ -95,16 +95,16 @@ msgstr "en attente"
95
  #: new-user-approve.php:320
96
  #, php-format
97
  msgid "There are no users with a status of %s"
98
- msgstr "il n'y a aucun utilisateur avec le status %s"
99
 
100
  #: new-user-approve.php:332
101
  msgid "User name already exists"
102
- msgstr "Nom d'utilisateur déjà existant"
103
 
104
  #: new-user-approve.php:335
105
  #, php-format
106
  msgid "%1$s (%2$s) has requested a username at %3$s"
107
- msgstr "%1$s (%2$s) a demandé l'approbation d'un compte sur %3$s"
108
 
109
  #: new-user-approve.php:337
110
  #, php-format
@@ -119,7 +119,7 @@ msgstr "[%s] Demande d'approbation pour un utilisateur"
119
  #: new-user-approve.php:372
120
  #, php-format
121
  msgid "You have been approved to access %s"
122
- msgstr "Votre inscription a été acceptée pour accéder au site %s"
123
 
124
  #: new-user-approve.php:373
125
  #, php-format
@@ -134,21 +134,21 @@ msgstr "Mot de passe : %s"
134
  #: new-user-approve.php:378
135
  #, php-format
136
  msgid "[%s] Registration Approved"
137
- msgstr "[%s] Inscription approuvée"
138
 
139
  #: new-user-approve.php:397
140
  #, php-format
141
  msgid "You have been denied access to %s"
142
- msgstr "Votre inscription a été refusée pour accéder au site %s"
143
 
144
  #: new-user-approve.php:400
145
  #, php-format
146
  msgid "[%s] Registration Denied"
147
- msgstr "[%s] Inscription refusée"
148
 
149
  #: new-user-approve.php:413
150
  msgid "An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request."
151
- msgstr "Un email a été envoyé à l'administrateur du site. Il va vérifier les informations que vous avez transmises et approuver ou refuser votre demande d'inscription. "
152
 
153
  #: new-user-approve.php:414
154
  msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
@@ -160,20 +160,20 @@ msgstr "Approbation en attente"
160
 
161
  #: new-user-approve.php:418
162
  msgid "Registration successful."
163
- msgstr "Inscription réussie"
164
 
165
  #: new-user-approve.php:466
166
  #, php-format
167
  msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
168
- msgstr "Bienvenue à %s. Ce site est accessible aux utilisateurs approuvés. Pour être approuvé, vous devez d'abord vous inscrire."
169
 
170
  #: new-user-approve.php:471
171
  msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
172
- msgstr "Après l'inscription, votre demande sera envoyée à l'administrateur pour approbation. Vous recevrez alors un email avec plus d'informations."
173
 
174
  #. Plugin Name of an extension
175
  msgid "New User Approve"
176
- msgstr "Nouvel utilisateur approuvé"
177
 
178
  #. Plugin URI of an extension
179
  msgid "http://www.picklewagon.com/wordpress/new-user-approve"
3
  "Project-Id-Version: New User Approve 1.0\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
5
  "POT-Creation-Date: 2009-10-29 08:32+0000\n"
6
+ "PO-Revision-Date: 2012-06-18 22:39+0100\n"
7
  "Last-Translator: Josh Harrison <josh@picklewagon.com>\n"
8
  "Language-Team: Philippe Scoffoni <philippe@scoffoni.net>\n"
9
  "MIME-Version: 1.0\n"
17
 
18
  #: new-user-approve.php:140
19
  msgid "Settings"
20
+ msgstr "Param&#232;tres"
21
 
22
  #: new-user-approve.php:183
23
  msgid "Users"
25
 
26
  #: new-user-approve.php:219
27
  msgid "User successfully updated."
28
+ msgstr "Utilisateur mis &#224; jour avec succ&#232;s"
29
 
30
  #: new-user-approve.php:223
31
  msgid "User Registration Approval"
41
 
42
  #: new-user-approve.php:229
43
  msgid "Approved Users"
44
+ msgstr "Utilisateurs approuv&#233;s"
45
 
46
  #: new-user-approve.php:230
47
  msgid "Denied Users"
48
+ msgstr "Utilisateurs refus&#233;s"
49
 
50
  #: new-user-approve.php:255
51
  msgid "ID"
82
 
83
  #: new-user-approve.php:313
84
  msgid "approved"
85
+ msgstr "approuv&#233;"
86
 
87
  #: new-user-approve.php:315
88
  msgid "denied"
89
+ msgstr "refus&#233;"
90
 
91
  #: new-user-approve.php:317
92
  msgid "pending"
95
  #: new-user-approve.php:320
96
  #, php-format
97
  msgid "There are no users with a status of %s"
98
+ msgstr "Il n'y a aucun utilisateur avec le status %s"
99
 
100
  #: new-user-approve.php:332
101
  msgid "User name already exists"
102
+ msgstr "Nom d'utilisateur d&#233;j&#224; existant"
103
 
104
  #: new-user-approve.php:335
105
  #, php-format
106
  msgid "%1$s (%2$s) has requested a username at %3$s"
107
+ msgstr "%1$s (%2$s) a demand&#233; l'approbation d'un compte sur %3$s"
108
 
109
  #: new-user-approve.php:337
110
  #, php-format
119
  #: new-user-approve.php:372
120
  #, php-format
121
  msgid "You have been approved to access %s"
122
+ msgstr "Votre inscription a &#233;t&#233; accept&#233;e pour acc&#233;der au site %s"
123
 
124
  #: new-user-approve.php:373
125
  #, php-format
134
  #: new-user-approve.php:378
135
  #, php-format
136
  msgid "[%s] Registration Approved"
137
+ msgstr "[%s] Inscription approuv&#233;e"
138
 
139
  #: new-user-approve.php:397
140
  #, php-format
141
  msgid "You have been denied access to %s"
142
+ msgstr "Votre inscription a &#233;t&#233; refus&#233;e pour acc&#233;der au site %s"
143
 
144
  #: new-user-approve.php:400
145
  #, php-format
146
  msgid "[%s] Registration Denied"
147
+ msgstr "[%s] Inscription refus&#233;e"
148
 
149
  #: new-user-approve.php:413
150
  msgid "An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request."
151
+ msgstr "Un email a &#233;t&#233; envoy&#233; &#224; l'administrateur du site. Il va v&#233;rifier les informations que vous avez transmises et approuver ou refuser votre demande d'inscription. "
152
 
153
  #: new-user-approve.php:414
154
  msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
160
 
161
  #: new-user-approve.php:418
162
  msgid "Registration successful."
163
+ msgstr "Inscription r&#233;ussie"
164
 
165
  #: new-user-approve.php:466
166
  #, php-format
167
  msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
168
+ msgstr "Bienvenue sur le site %s. Ce site est accessible aux utilisateurs approuv&#233;s. Pour &#234;tre approuv&#233;, vous devez d'abord vous inscrire."
169
 
170
  #: new-user-approve.php:471
171
  msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
172
+ msgstr "Apr&#232;s l'inscription, votre demande sera envoy&#233;e &#224; l'administrateur pour approbation. Vous recevrez alors un email avec plus d'informations."
173
 
174
  #. Plugin Name of an extension
175
  msgid "New User Approve"
176
+ msgstr "Nouvel utilisateur approuv&#233;"
177
 
178
  #. Plugin URI of an extension
179
  msgid "http://www.picklewagon.com/wordpress/new-user-approve"
localization/new-user-approve-hr_HR.mo ADDED
Binary file
localization/new-user-approve-hr_HR.po ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Josh Harrison
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: New User Approve 1.0\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
10
+ "POT-Creation-Date: 2009-10-29 08:32+0000\n"
11
+ "PO-Revision-Date: 2012-08-29 16:32+0100\n"
12
+ "Last-Translator: Danijel Džombić <dzdanijel@gmail.com>\n"
13
+ "Language-Team: Danijel Džombić <dzdanijel@gmail.com>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
18
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) \n"
19
+ "Language: Hrvatski\n"
20
+ "X-Poedit-SourceCharset: UTF-8\n"
21
+
22
+ #: new-user-approve.php:126
23
+ msgid "Approve New Users"
24
+ msgstr "Odobravanje novih korisnika"
25
+
26
+ #: new-user-approve.php:140
27
+ msgid "Settings"
28
+ msgstr "Postavke"
29
+
30
+ #: new-user-approve.php:183
31
+ msgid "Users"
32
+ msgstr "Korisnici"
33
+
34
+ #: new-user-approve.php:219
35
+ msgid "User successfully updated."
36
+ msgstr "Korisnik uspješno ažuriran."
37
+
38
+ #: new-user-approve.php:223
39
+ msgid "User Registration Approval"
40
+ msgstr "Odobrenje registracije korisnika"
41
+
42
+ #: new-user-approve.php:225
43
+ msgid "User Management"
44
+ msgstr "Upravljanje korisnicima"
45
+
46
+ #: new-user-approve.php:228
47
+ msgid "Users Pending Approval"
48
+ msgstr "Odobrenje korisnika na čekanju"
49
+
50
+ #: new-user-approve.php:229
51
+ msgid "Approved Users"
52
+ msgstr "Odobreni korisnici"
53
+
54
+ #: new-user-approve.php:230
55
+ msgid "Denied Users"
56
+ msgstr "Odbijeni korisnici"
57
+
58
+ #: new-user-approve.php:255
59
+ msgid "ID"
60
+ msgstr "ID"
61
+
62
+ #: new-user-approve.php:256
63
+ msgid "Username"
64
+ msgstr "Korisničko ime"
65
+
66
+ #: new-user-approve.php:257
67
+ msgid "Name"
68
+ msgstr "Ime"
69
+
70
+ #: new-user-approve.php:258
71
+ msgid "E-mail"
72
+ msgstr "E-mail"
73
+
74
+ #: new-user-approve.php:260 new-user-approve.php:262
75
+ msgid "Actions"
76
+ msgstr "Akcije"
77
+
78
+ #: new-user-approve.php:296
79
+ msgid "email:"
80
+ msgstr "email:"
81
+
82
+ #: new-user-approve.php:298
83
+ msgid "Approve"
84
+ msgstr "Odobri"
85
+
86
+ #: new-user-approve.php:301
87
+ msgid "Deny"
88
+ msgstr "Odbiti"
89
+
90
+ #: new-user-approve.php:313
91
+ msgid "approved"
92
+ msgstr "odobreno"
93
+
94
+ #: new-user-approve.php:315
95
+ msgid "denied"
96
+ msgstr "odbijen"
97
+
98
+ #: new-user-approve.php:317
99
+ msgid "pending"
100
+ msgstr "na čekanju"
101
+
102
+ #: new-user-approve.php:320
103
+ #, php-format
104
+ msgid "There are no users with a status of %s"
105
+ msgstr "Nema korisnika sa statusom %s"
106
+
107
+ #: new-user-approve.php:332
108
+ msgid "User name already exists"
109
+ msgstr "Korisničko ime već postoji"
110
+
111
+ #: new-user-approve.php:335
112
+ #, php-format
113
+ msgid "%1$s (%2$s) has requested a username at %3$s"
114
+ msgstr "%1$s (%2$s) zatražio je korisničko ime na %3$s"
115
+
116
+ #: new-user-approve.php:337
117
+ #, php-format
118
+ msgid "To approve or deny this user access to %s go to"
119
+ msgstr "Da biste odobrili ili odbili pristup ovom korisniku %s idite na"
120
+
121
+ #: new-user-approve.php:341
122
+ #, php-format
123
+ msgid "[%s] User Approval"
124
+ msgstr "[%s] Odobrenje korisnika"
125
+
126
+ #: new-user-approve.php:372
127
+ #, php-format
128
+ msgid "You have been approved to access %s"
129
+ msgstr "Odabren vam je pristup %s"
130
+
131
+ #: new-user-approve.php:373
132
+ #, php-format
133
+ msgid "Username: %s"
134
+ msgstr "Korisničko ime: %s"
135
+
136
+ #: new-user-approve.php:374
137
+ #, php-format
138
+ msgid "Password: %s"
139
+ msgstr "Lozinka: %s"
140
+
141
+ #: new-user-approve.php:378
142
+ #, php-format
143
+ msgid "[%s] Registration Approved"
144
+ msgstr "[%s] Odobrena registracija"
145
+
146
+ #: new-user-approve.php:397
147
+ #, php-format
148
+ msgid "You have been denied access to %s"
149
+ msgstr "Odbijen vam je pristup %s"
150
+
151
+ #: new-user-approve.php:400
152
+ #, php-format
153
+ msgid "[%s] Registration Denied"
154
+ msgstr "[%s] Odbijena registracija"
155
+
156
+ #: new-user-approve.php:413
157
+ msgid ""
158
+ "An email has been sent to the site administrator. The administrator will "
159
+ "review the information that has been submitted and either approve or deny "
160
+ "your request."
161
+ msgstr ""
162
+ "E-mail je poslan na web administratoru. Administrator će pregledati poslane "
163
+ "informacije koje će odobriti ili odbiti tvoj zahtjev."
164
+
165
+ #: new-user-approve.php:414
166
+ msgid ""
167
+ "You will receive an email with instructions on what you will need to do "
168
+ "next. Thanks for your patience."
169
+ msgstr ""
170
+ "Primit ćete poruku e-pošte s uputama o tome što trebate učiniti sljedeće. "
171
+ "Hvala na strpljenju."
172
+
173
+ #: new-user-approve.php:418
174
+ msgid "Pending Approval"
175
+ msgstr "Odobrenje na čekanju"
176
+
177
+ #: new-user-approve.php:418
178
+ msgid "Registration successful."
179
+ msgstr "Registracija uspješna"
180
+
181
+ #: new-user-approve.php:466
182
+ #, php-format
183
+ msgid ""
184
+ "Welcome to %s. This site is accessible to approved users only. To be "
185
+ "approved, you must first register."
186
+ msgstr ""
187
+ "Dobrodošli na %s. Ova stranica je dostupna odobrenim korisnicima. Da bi vam "
188
+ "se odobrio pristup, najprije se morate registrirati."
189
+
190
+ #: new-user-approve.php:471
191
+ msgid ""
192
+ "After you register, your request will be sent to the site administrator for "
193
+ "approval. You will then receive an email with further instructions."
194
+ msgstr ""
195
+ "Nakon registracije, vaš zahtjev biti će poslan web administratoru na "
196
+ "odobrenje. Nakon toga primiti ćete e-mail s uputama."
197
+
198
+ #. Plugin Name of an extension
199
+ msgid "New User Approve"
200
+ msgstr "Odobren korisnik"
201
+
202
+ #. Plugin URI of an extension
203
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
204
+ msgstr "http://www.picklewagon.com/wordpress/new-user-approve"
205
+
206
+ #. Description of an extension
207
+ msgid ""
208
+ "This plugin allows administrators to approve users once they register. Only "
209
+ "approved users will be allowed to access the blog."
210
+ msgstr ""
211
+ "Ovaj dodatak omogućuje administratorima da odobre korisnike nakon što su se "
212
+ "registrirali. Samo odobrenim korisnicima biti će momogućen pristup blogu."
213
+
214
+ #. Author of an extension
215
+ msgid "Josh Harrison"
216
+ msgstr "Josh Harrison"
217
+
218
+ #. Author URI of an extension
219
+ msgid "http://www.picklewagon.com/"
220
+ msgstr "http://www.picklewagon.com/"
localization/new-user-approve-ru_RU.mo ADDED
Binary file
localization/new-user-approve-ru_RU.po ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: New User Approve v1.3.4\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2012-09-17 17:53:03+0000\n"
7
+ "Last-Translator: Alexey <4selin@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: Russian\n"
14
+ "X-Poedit-Country: RUSSIA\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: ../\n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #: new-user-approve.php:74
23
+ #, php-format
24
+ #@ new-user-approve
25
+ msgid "New User Approve requires WordPress %s or newer."
26
+ msgstr "Плагин New User Approve требует WordPress версии %s или более позднюю"
27
+
28
+ #: new-user-approve.php:117
29
+ #@ new-user-approve
30
+ msgid "Users"
31
+ msgstr "Пользователи"
32
+
33
+ #: new-user-approve.php:129
34
+ #@ new-user-approve
35
+ msgid "User successfully updated."
36
+ msgstr "Пользователь успешно обновлен."
37
+
38
+ #: new-user-approve.php:133
39
+ #@ new-user-approve
40
+ msgid "User Registration Approval"
41
+ msgstr "Одобрение регистрации пользователя"
42
+
43
+ #: new-user-approve.php:135
44
+ #@ new-user-approve
45
+ msgid "User Management"
46
+ msgstr "Управление пользователями"
47
+
48
+ #: new-user-approve.php:138
49
+ #@ new-user-approve
50
+ msgid "Users Pending Approval"
51
+ msgstr "Пользователи, ожидающие одобрения"
52
+
53
+ #: new-user-approve.php:139
54
+ #@ new-user-approve
55
+ msgid "Approved Users"
56
+ msgstr "Одобренные пользователи"
57
+
58
+ #: new-user-approve.php:140
59
+ #@ new-user-approve
60
+ msgid "Denied Users"
61
+ msgstr "Отклоненные пользователи"
62
+
63
+ #: new-user-approve.php:190
64
+ #@ new-user-approve
65
+ msgid "Username"
66
+ msgstr "Имя пользователя"
67
+
68
+ #: new-user-approve.php:191
69
+ #@ new-user-approve
70
+ msgid "Name"
71
+ msgstr "Имя"
72
+
73
+ #: new-user-approve.php:192
74
+ #@ new-user-approve
75
+ msgid "E-mail"
76
+ msgstr "E-mail"
77
+
78
+ #: new-user-approve.php:194
79
+ #: new-user-approve.php:196
80
+ #@ new-user-approve
81
+ msgid "Actions"
82
+ msgstr "Действия"
83
+
84
+ #: new-user-approve.php:229
85
+ #@ new-user-approve
86
+ msgid "email:"
87
+ msgstr "email:"
88
+
89
+ #: new-user-approve.php:231
90
+ #@ new-user-approve
91
+ msgid "Approve"
92
+ msgstr "Одобрить"
93
+
94
+ #: new-user-approve.php:234
95
+ #@ new-user-approve
96
+ msgid "Deny"
97
+ msgstr "Отклонить"
98
+
99
+ #: new-user-approve.php:246
100
+ #@ new-user-approve
101
+ msgid "approved"
102
+ msgstr "одобренный"
103
+
104
+ #: new-user-approve.php:248
105
+ #@ new-user-approve
106
+ msgid "denied"
107
+ msgstr "отклоненный"
108
+
109
+ #: new-user-approve.php:250
110
+ #@ new-user-approve
111
+ msgid "pending"
112
+ msgstr "ожидает"
113
+
114
+ #: new-user-approve.php:253
115
+ #, php-format
116
+ #@ new-user-approve
117
+ msgid "There are no users with a status of %s"
118
+ msgstr "Нет пользователей со статусом %s"
119
+
120
+ #: new-user-approve.php:265
121
+ #@ new-user-approve
122
+ msgid "User name already exists"
123
+ msgstr "Имя пользователя уже существует"
124
+
125
+ #: new-user-approve.php:268
126
+ #, php-format
127
+ #@ new-user-approve
128
+ msgid "%1$s (%2$s) has requested a username at %3$s"
129
+ msgstr "%1$s (%2$s) запросил имя пользователя в %3$s"
130
+
131
+ #: new-user-approve.php:270
132
+ #, php-format
133
+ #@ new-user-approve
134
+ msgid "To approve or deny this user access to %s go to"
135
+ msgstr "Чтобы одобрить или отклонить доступ пользователя к %s перейдите в"
136
+
137
+ #: new-user-approve.php:274
138
+ #, php-format
139
+ #@ new-user-approve
140
+ msgid "[%s] User Approval"
141
+ msgstr "[%s] Пользователей одобрено"
142
+
143
+ #: new-user-approve.php:311
144
+ #, php-format
145
+ #@ new-user-approve
146
+ msgid "You have been approved to access %s"
147
+ msgstr "Вам разрешен доступ к %s"
148
+
149
+ #: new-user-approve.php:312
150
+ #, php-format
151
+ #@ new-user-approve
152
+ msgid "Username: %s"
153
+ msgstr "Имя пользователя: %s"
154
+
155
+ #: new-user-approve.php:313
156
+ #, php-format
157
+ #@ new-user-approve
158
+ msgid "Password: %s"
159
+ msgstr "Пароль: %s"
160
+
161
+ #: new-user-approve.php:317
162
+ #, php-format
163
+ #@ new-user-approve
164
+ msgid "[%s] Registration Approved"
165
+ msgstr "[%s] Регистрация одобрена"
166
+
167
+ #: new-user-approve.php:334
168
+ #, php-format
169
+ #@ new-user-approve
170
+ msgid "You have been denied access to %s"
171
+ msgstr "Вам запрещен доступ к %s"
172
+
173
+ #: new-user-approve.php:337
174
+ #, php-format
175
+ #@ new-user-approve
176
+ msgid "[%s] Registration Denied"
177
+ msgstr "[%s] Регистраций отклонено"
178
+
179
+ #: new-user-approve.php:350
180
+ #@ new-user-approve
181
+ msgid "An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request."
182
+ msgstr "Запрос на регистрацию отправлен администратору сайта."
183
+
184
+ #: new-user-approve.php:351
185
+ #@ new-user-approve
186
+ msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
187
+ msgstr "На ваш адрес придет письмо с инструкциями о дальнейших действиях. Спасибо за ваше терпение."
188
+
189
+ #: new-user-approve.php:356
190
+ #@ new-user-approve
191
+ msgid "Pending Approval"
192
+ msgstr "Ожидает одобрения"
193
+
194
+ #: new-user-approve.php:356
195
+ #@ new-user-approve
196
+ msgid "Registration successful."
197
+ msgstr "Регистрация прошла успешно."
198
+
199
+ #: new-user-approve.php:405
200
+ #, php-format
201
+ #@ new-user-approve
202
+ msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
203
+ msgstr "Добро пожаловать на %s. Этот сайт доступен только для одобренных пользователей. Для начала зарегистрируйтесь."
204
+
205
+ #: new-user-approve.php:410
206
+ #@ new-user-approve
207
+ msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
208
+ msgstr "После регистрации ваш запрос будет отправлен администратору сайта на рассмотрение. После рассмотрения вы получите письмо с дальнейшими инструкциями."
209
+
210
+ #: new-user-approve.php:426
211
+ #@ new-user-approve
212
+ msgid "Approve New Users"
213
+ msgstr "Одобрить нового пользователя"
214
+
215
+ #: new-user-approve.php:440
216
+ #@ default
217
+ msgid "<strong>ERROR</strong>: Your account is still pending approval."
218
+ msgstr ""
219
+
220
+ #: new-user-approve.php:443
221
+ #@ default
222
+ msgid "<strong>ERROR</strong>: Your account has been denied access to this site."
223
+ msgstr ""
224
+
new-user-approve.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve/
5
  Description: This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
6
  Author: Josh Harrison
7
- Version: 1.3.4
8
  Author URI: http://www.picklewagon.com/
9
  */
10
 
@@ -24,7 +24,7 @@
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
- if (!class_exists('pw_new_user_approve')) {
28
  class pw_new_user_approve {
29
  /**
30
  * @var string $plugin_id unique identifier used for localization and other functions
@@ -47,41 +47,72 @@ class pw_new_user_approve {
47
  public function __construct() {
48
  // Load up the localization file if we're using WordPress in a different language
49
  // Just drop it in this plugin's "localization" folder and name it "new-user-approve-[value in wp-config].mo"
50
- load_plugin_textdomain($this->plugin_id, false, dirname(plugin_basename(__FILE__)) . '/localization');
51
 
52
- register_activation_hook(__FILE__, array( $this, 'activation_check'));
53
 
54
  // Actions
55
- add_action('admin_menu', array( $this, 'admin_menu_link'));
56
- add_action('admin_footer', array( $this, 'admin_scripts_footer'));
57
- add_action('init', array( $this, 'init'));
58
- add_action('init', array( $this, 'process_input'));
59
- add_action('register_post', array( $this, 'send_approval_email'), 10, 3);
60
- add_action('lostpassword_post', array( $this, 'lost_password'));
61
- add_action( 'user_register', array( $this, 'add_user_status' ) );
62
- //add_action('rightnow_end', array( $this, 'dashboard_stats')); // still too slow
 
 
 
 
 
63
 
64
  // Filters
65
- add_filter('registration_errors', array( $this, 'show_user_message'), 10, 1);
66
- add_filter('login_message', array( $this, 'welcome_user'));
67
- add_filter( 'wp_authenticate_user', array( $this, 'authenticate_user' ), 10, 2);
68
  }
69
 
 
 
 
 
 
70
  public function activation_check() {
71
  global $wp_version;
72
 
73
- $min_wp_version = '3.1';
74
- $exit_msg = sprintf( __('New User Approve requires WordPress %s or newer.', $this->plugin_id), $min_wp_version );
75
- if (version_compare($wp_version, $min_wp_version, '<=')) {
76
- exit($exit_msg);
77
  }
78
  }
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  public function admin_scripts_footer() {
81
  global $wp_db_version;
82
 
83
- if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page) {
84
- $page_id = ($wp_db_version >= 10851) ? '#pw_approve_tabs' : '#pw_approve_tabs > ul';
85
  ?>
86
  <script type="text/javascript">
87
  //<![CDATA[
@@ -95,58 +126,42 @@ class pw_new_user_approve {
95
  }
96
 
97
  public function dashboard_stats() {
98
- // Query the users table
99
- $wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage']);
100
- $user_status = array();
101
-
102
- // Make the user objects
103
- foreach ($wp_user_search->get_results() as $userid) {
104
- $user = new WP_User($userid);
105
- $status = get_usermeta($userid, 'pw_user_status');
106
- if ($status == '') { // user was created in admin
107
- update_user_meta($userid, 'pw_user_status', 'approved');
108
- $status = get_usermeta($userid, 'pw_user_status');
109
- }
110
- if ($user_status[$status] == null) {
111
- $user_status[$status] = 0;
112
- }
113
- $user_status[$status] += 1;
114
- }
115
  ?>
116
  <div>
117
- <p><span style="font-weight:bold;"><a href="users.php?page=<?php print $this->_admin_page ?>"><?php _e('Users', $this->plugin_id) ?></a></span>:
118
- <?php foreach($user_status as $status =>$count) print "$count $status&nbsp;&nbsp;"; ?>
119
  </p>
120
  </div>
121
  <?php
122
  }
123
 
124
  /**
125
- * @desc create the view for the admin interface
126
  */
127
  public function approve_admin() {
128
- if (isset($_GET['user']) && isset($_GET['status'])) {
129
- echo '<div id="message" class="updated fade"><p>'.__('User successfully updated.', $this->plugin_id).'</p></div>';
130
  }
131
  ?>
132
  <div class="wrap">
133
- <h2><?php _e('User Registration Approval', $this->plugin_id) ?></h2>
134
 
135
- <h3><?php _e('User Management', $this->plugin_id) ?></h3>
136
  <div id="pw_approve_tabs">
137
  <ul>
138
- <li><a href="#pw_pending_users"><span><?php _e('Users Pending Approval', $this->plugin_id) ?></span></a></li>
139
- <li><a href="#pw_approved_users"><span><?php _e('Approved Users', $this->plugin_id) ?></span></a></li>
140
- <li><a href="#pw_denied_users"><span><?php _e('Denied Users', $this->plugin_id) ?></span></a></li>
141
  </ul>
142
  <div id="pw_pending_users">
143
- <?php $this->approve_table( 'pending', true, true ); ?>
144
  </div>
145
  <div id="pw_approved_users">
146
- <?php $this->approve_table( 'approved', false, true ); ?>
147
  </div>
148
  <div id="pw_denied_users">
149
- <?php $this->approve_table( 'denied', true, false ); ?>
150
  </div>
151
  </div>
152
  </div>
@@ -154,46 +169,31 @@ class pw_new_user_approve {
154
  }
155
 
156
  /**
157
- * @desc the table that shows the registered users grouped by status
 
 
158
  */
159
- public function approve_table($status, $approve, $deny) {
160
  global $current_user;
161
-
162
- if ( $status != 'approved' ) {
163
- // Query the users table
164
- $query = array(
165
- 'meta_key' => 'pw_user_status',
166
- 'meta_value' => $status,
167
- );
168
- $wp_user_search = new WP_User_Query( $query );
169
- } else {
170
- $users = get_users( 'blog_id=1' );
171
- $approved_users = array();
172
- foreach( $users as $user ) {
173
- $the_status = get_user_meta( $user->ID, 'pw_user_status', true );
174
-
175
- if ( $the_status == 'approved' || empty( $the_status ) ) {
176
- $approved_users[] = $user->ID;
177
- }
178
- }
179
-
180
- // get all approved users and any usr without a status
181
- $query = array( 'include' => $approved_users );
182
- $wp_user_search = new WP_User_Query( $query );
183
- }
184
-
185
- if ( isset( $wp_user_search ) && $wp_user_search->total_users > 0 ) {
186
  ?>
187
  <table class="widefat">
188
  <thead>
189
  <tr class="thead">
190
- <th><?php _e('Username', $this->plugin_id) ?></th>
191
- <th><?php _e('Name', $this->plugin_id) ?></th>
192
- <th><?php _e('E-mail', $this->plugin_id) ?></th>
193
- <?php if ($approve && $deny) { ?>
194
- <th colspan="2" style="text-align: center"><?php _e('Actions', $this->plugin_id) ?></th>
195
  <?php } else { ?>
196
- <th style="text-align: center"><?php _e('Actions', $this->plugin_id) ?></th>
197
  <?php } ?>
198
  </tr>
199
  </thead>
@@ -201,16 +201,16 @@ class pw_new_user_approve {
201
  <?php
202
  // show each of the users
203
  $row = 1;
204
- foreach ($wp_user_search->get_results() as $user) {
205
- $class = ($row % 2) ? '' : ' class="alternate"';
206
  $avatar = get_avatar( $user->user_email, 32 );
207
- if ($approve) {
208
- $approve_link = get_option('siteurl').'/wp-admin/users.php?page='.$this->_admin_page.'&user='.$user->ID.'&status=approve';
209
- $approve_link = wp_nonce_url($approve_link, 'pw_new_user_approve_action_' . get_class($this));
210
  }
211
- if ($deny) {
212
- $deny_link = get_option('siteurl').'/wp-admin/users.php?page='.$this->_admin_page.'&user='.$user->ID.'&status=deny';
213
- $deny_link = wp_nonce_url($deny_link, 'pw_new_user_approve_action_' . get_class($this));
214
  }
215
  if ( current_user_can( 'edit_user', $user->ID ) ) {
216
  if ($current_user->ID == $user->ID) {
@@ -224,14 +224,14 @@ class pw_new_user_approve {
224
  }
225
 
226
  ?><tr <?php echo $class; ?>>
227
- <td><?php echo $avatar." ".$edit; ?></td>
228
- <td><?php echo get_user_meta( $user->ID, 'first_name', true )." ".get_user_meta( $user->ID, 'last_name', true ); ?></td>
229
  <td><a href="mailto:<?php echo $user->user_email; ?>" title="<?php _e('email:', $this->plugin_id) ?> <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
230
- <?php if ($approve) { ?>
231
- <td align="center"><a href="<?php echo $approve_link; ?>" title="<?php _e('Approve', $this->plugin_id) ?> <?php echo $user->user_login; ?>"><?php _e('Approve', $this->plugin_id) ?></a></td>
232
  <?php } ?>
233
- <?php if ($deny) { ?>
234
- <td align="center"><a href="<?php echo $deny_link; ?>" title="<?php _e('Deny', $this->plugin_id) ?> <?php echo $user->user_login; ?>"><?php _e('Deny', $this->plugin_id) ?></a></td>
235
  <?php } ?>
236
  </tr><?php
237
  $row++;
@@ -242,46 +242,51 @@ class pw_new_user_approve {
242
  <?php
243
  } else {
244
  $status_i18n = $status;
245
- if ($status == 'approved') {
246
- $status_i18n = __('approved', $this->plugin_id);
247
- } else if ($status == 'denied') {
248
- $status_i18n = __('denied', $this->plugin_id);
249
- } else if ($status == 'pending') {
250
- $status_i18n = __('pending', $this->plugin_id);
251
  }
252
 
253
- echo '<p>'.sprintf(__('There are no users with a status of %s', $this->plugin_id), $status_i18n).'</p>';
254
  }
255
  }
256
 
257
  /**
258
- * @desc send an email to the admin to request approval
259
  */
260
- public function send_approval_email($user_login, $user_email, $errors) {
261
- if (!$errors->get_error_code()) {
262
  /* check if already exists */
263
  $user_data = get_user_by( 'login', $user_login );
264
- if (!empty($user_data)){
265
- $errors->add('registration_required' , __('User name already exists', $this->plugin_id), 'message');
266
  } else {
267
  /* send email to admin for approval */
268
- $message = sprintf(__('%1$s (%2$s) has requested a username at %3$s', $this->plugin_id), $user_login, $user_email, get_option('blogname')) . "\r\n\r\n";
269
- $message .= get_option('siteurl') . "\r\n\r\n";
270
- $message .= sprintf(__('To approve or deny this user access to %s go to', $this->plugin_id), get_option('blogname')) . "\r\n\r\n";
271
- $message .= get_option('siteurl') . "/wp-admin/users.php?page=".$this->_admin_page."\r\n";
 
 
 
 
 
272
 
273
  // send the mail
274
- wp_mail(get_option('admin_email'), sprintf(__('[%s] User Approval', $this->plugin_id), get_option('blogname')), $message);
275
 
276
  // create the user
277
  $user_pass = wp_generate_password();
278
- $user_id = wp_create_user($user_login, $user_pass, $user_email);
279
  }
280
  }
281
  }
282
 
283
  /**
284
- * @desc admin approval of user
285
  */
286
  public function approve_user() {
287
  global $wpdb;
@@ -289,102 +294,133 @@ class pw_new_user_approve {
289
  $user_id = (int) $_GET['user'];
290
  $user = new WP_User( $user_id );
291
 
292
- // reset password to know what to send the user
293
- $new_pass = wp_generate_password();
294
- $data = array(
295
- 'user_pass' => md5($new_pass),
296
- 'user_activation_key' => '',
297
- );
298
- $where = array(
299
- 'ID' => $user->ID,
300
- );
301
- $wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d'));
 
 
 
 
302
 
303
- wp_cache_delete($user->ID, 'users');
304
- wp_cache_delete($user->user_login, 'userlogins');
305
 
306
  // send email to user telling of approval
307
- $user_login = stripslashes($user->user_login);
308
- $user_email = stripslashes($user->user_email);
309
 
310
  // format the message
311
- $message = sprintf(__('You have been approved to access %s', $this->plugin_id), get_option('blogname')) . "\r\n";
312
- $message .= sprintf(__('Username: %s', $this->plugin_id), $user_login) . "\r\n";
313
- $message .= sprintf(__('Password: %s', $this->plugin_id), $new_pass) . "\r\n";
314
- $message .= get_option('siteurl') . "/wp-login.php\r\n";
 
 
315
 
 
 
 
 
 
316
  // send the mail
317
- @wp_mail($user_email, sprintf(__('[%s] Registration Approved', $this->plugin_id), get_option('blogname')), $message);
318
 
319
  // change usermeta tag in database to approved
320
- update_user_meta($user->ID, 'pw_user_status', 'approved');
 
 
321
  }
322
 
323
  /**
324
- * @desc admin denial of user
325
  */
326
  public function deny_user() {
327
  $user_id = (int) $_GET['user'];
328
  $user = new WP_User( $user_id );
329
 
330
  // send email to user telling of denial
331
- $user_email = stripslashes($user->user_email);
332
 
333
  // format the message
334
- $message = sprintf(__('You have been denied access to %s', $this->plugin_id), get_option('blogname'));
 
 
 
 
335
 
336
  // send the mail
337
- @wp_mail($user_email, sprintf(__('[%s] Registration Denied', $this->plugin_id), get_option('blogname')), $message);
338
 
339
  // change usermeta tag in database to denied
340
- update_user_meta($user->ID, 'pw_user_status', 'denied');
 
 
341
  }
342
 
343
  /**
344
- * @desc display a message to the user if they have not been approved
345
  */
346
- public function show_user_message($errors) {
 
 
 
 
 
 
 
347
  if ( $errors->get_error_code() )
348
  return $errors;
349
-
350
- $message = sprintf(__('An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request.', $this->plugin_id));
351
- $message .= sprintf(__('You will receive an email with instructions on what you will need to do next. Thanks for your patience.', $this->plugin_id));
352
-
353
- $errors->add('registration_required', $message, 'message');
354
-
355
- if (function_exists('login_header')) {
356
- login_header(__('Pending Approval', $this->plugin_id), '<p class="message register">' . __("Registration successful.", $this->plugin_id) . '</p>', $errors);
 
 
 
 
 
 
 
 
357
  }
358
-
359
- echo "<body></html>";
360
- exit();
361
  }
362
 
363
  /**
364
- * @desc accept input from admin to modify a user
365
  */
366
  public function process_input() {
367
- if ((isset($_GET['page']) && $_GET['page'] == $this->_admin_page) && isset($_GET['status'])) {
368
- $valid_request = check_admin_referer('pw_new_user_approve_action_' . get_class($this));
369
 
370
- if ($valid_request) {
371
- if ($_GET['status'] == 'approve') {
372
- $this->approve_user();
373
  }
374
 
375
- if ($_GET['status'] == 'deny') {
376
- $this->deny_user();
377
  }
378
  }
379
  }
380
  }
381
 
382
  /**
383
- * @desc only give a user their password if they have been approved
384
  */
385
  public function lost_password() {
386
- $is_email = strpos($_POST['user_login'], '@');
387
- if ($is_email === false) {
388
  $username = sanitize_user( $_POST['user_login'] );
389
  $user_data = get_user_by( 'login', trim( $username ) );
390
  } else {
@@ -392,40 +428,44 @@ class pw_new_user_approve {
392
  $user_data = get_user_by( 'email', $email );
393
  }
394
 
395
- if ($user_data->pw_user_status != 'approved') {
396
- wp_redirect('wp-login.php');
397
  exit();
398
  }
399
 
400
  return;
401
  }
402
 
 
 
 
 
 
 
403
  public function welcome_user($message) {
404
- if (!isset($_GET['action'])) {
405
- $inside = sprintf(__('Welcome to %s. This site is accessible to approved users only. To be approved, you must first register.', $this->plugin_id), get_option('blogname'));
406
- $message .= '<p class="message">' . $inside . '</p>';
 
 
407
  }
408
 
409
- if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && !$_POST ) {
410
- $inside = sprintf(__('After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions.', $this->plugin_id));
411
- $message .= '<p class="message">' . $inside . '</p>';
 
 
412
  }
413
 
414
  return $message;
415
  }
416
 
417
- public function init() {
418
- if ( is_admin() && isset($_GET['page']) && $_GET['page'] == $this->_admin_page ) {
419
- wp_enqueue_script('jquery-ui-tabs');
420
- wp_enqueue_style('pw-admin-ui-tabs', plugins_url( 'ui.tabs.css', __FILE__ ) );
421
- }
422
- }
423
-
424
- function admin_menu_link() {
425
- $cap = apply_filters( 'new_user_approve_minimum_cap', 'edit_users' );
426
- $this->user_page_hook = add_users_page( __('Approve New Users', $this->plugin_id), __('Approve New Users', $this->plugin_id), $cap, $this->_admin_page, array( $this, 'approve_admin' ) );
427
- }
428
-
429
  public function authenticate_user( $userdata, $password ) {
430
  $status = get_user_meta( $userdata->ID, 'pw_user_status', true );
431
 
@@ -437,10 +477,16 @@ class pw_new_user_approve {
437
  $message = false;
438
  switch ( $status ) {
439
  case 'pending':
440
- $message = new WP_Error('pending_approval', __('<strong>ERROR</strong>: Your account is still pending approval.'));
 
 
 
441
  break;
442
  case 'denied':
443
- $message = new WP_Error('denied_access', __('<strong>ERROR</strong>: Your account has been denied access to this site.'));
 
 
 
444
  break;
445
  case 'approved':
446
  $message = $userdata;
@@ -450,18 +496,74 @@ class pw_new_user_approve {
450
  return $message;
451
  }
452
 
 
 
 
 
453
  public function add_user_status( $user_id ) {
454
  $status = 'pending';
455
- if ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) {
456
  $status = 'approved';
457
  }
458
  update_user_meta( $user_id, 'pw_user_status', $status );
459
  }
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  } // End Class
462
  } // End if class exists statement
463
 
464
  // instantiate the class
465
- if (class_exists('pw_new_user_approve')) {
466
  $pw_new_user_approve = new pw_new_user_approve();
467
  }
4
  Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve/
5
  Description: This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
6
  Author: Josh Harrison
7
+ Version: 1.4
8
  Author URI: http://www.picklewagon.com/
9
  */
10
 
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
+ if ( ! class_exists( 'pw_new_user_approve' ) ) {
28
  class pw_new_user_approve {
29
  /**
30
  * @var string $plugin_id unique identifier used for localization and other functions
47
  public function __construct() {
48
  // Load up the localization file if we're using WordPress in a different language
49
  // Just drop it in this plugin's "localization" folder and name it "new-user-approve-[value in wp-config].mo"
50
+ load_plugin_textdomain( $this->plugin_id, false, dirname( plugin_basename( __FILE__ ) ) . '/localization' );
51
 
52
+ register_activation_hook( __FILE__, array( $this, 'activation_check' ) );
53
 
54
  // Actions
55
+ add_action( 'admin_menu', array( $this, 'admin_menu_link' ) );
56
+ add_action( 'admin_footer', array( $this, 'admin_scripts_footer' ) );
57
+ add_action( 'init', array( $this, 'init' ) );
58
+ add_action( 'init', array( $this, 'process_input' ) );
59
+ add_action( 'register_post', array( $this, 'send_approval_email' ), 10, 3 );
60
+ add_action( 'lostpassword_post', array( $this, 'lost_password' ) );
61
+ add_action( 'user_register', array( $this, 'add_user_status' ) );
62
+ add_action( 'new_user_approve_approve_user', array( $this, 'approve_user' ) );
63
+ add_action( 'new_user_approve_deny_user', array( $this, 'deny_user' ) );
64
+ add_action( 'rightnow_end', array( $this, 'dashboard_stats' ) );
65
+ add_action( 'user_register', array( $this, 'delete_new_user_approve_transient' ), 11 );
66
+ add_action( 'new_user_approve_approve_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
67
+ add_action( 'new_user_approve_deny_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
68
 
69
  // Filters
70
+ add_filter( 'registration_errors', array( $this, 'show_user_pending_message' ), 10, 1 );
71
+ add_filter( 'login_message', array( $this, 'welcome_user' ) );
72
+ add_filter( 'wp_authenticate_user', array( $this, 'authenticate_user' ), 10, 2 );
73
  }
74
 
75
+ /**
76
+ * Require WordPress 3.2.1 on activation
77
+ *
78
+ * @uses register_activation_hook
79
+ */
80
  public function activation_check() {
81
  global $wp_version;
82
 
83
+ $min_wp_version = '3.2.1';
84
+ $exit_msg = sprintf( __( 'New User Approve requires WordPress %s or newer.', $this->plugin_id ), $min_wp_version );
85
+ if ( version_compare( $wp_version, $min_wp_version, '<=' ) ) {
86
+ exit( $exit_msg );
87
  }
88
  }
89
 
90
+ /**
91
+ * Enqueue any javascript and css needed for the plugin
92
+ */
93
+ public function init() {
94
+ if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) {
95
+ wp_enqueue_script( 'jquery-ui-tabs' );
96
+ wp_enqueue_style( 'pw-admin-ui-tabs', plugins_url( 'ui.tabs.css', __FILE__ ) );
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Add the new menu item to the users portion of the admin menu
102
+ */
103
+ function admin_menu_link() {
104
+ $cap = apply_filters( 'new_user_approve_minimum_cap', 'edit_users' );
105
+ $this->user_page_hook = add_users_page( __( 'Approve New Users', $this->plugin_id ), __( 'Approve New Users', $this->plugin_id ), $cap, $this->_admin_page, array( $this, 'approve_admin' ) );
106
+ }
107
+
108
+ /**
109
+ * Output the javascript in the footer to display the tabs
110
+ */
111
  public function admin_scripts_footer() {
112
  global $wp_db_version;
113
 
114
+ if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) {
115
+ $page_id = ( $wp_db_version >= 10851 ) ? '#pw_approve_tabs' : '#pw_approve_tabs > ul';
116
  ?>
117
  <script type="text/javascript">
118
  //<![CDATA[
126
  }
127
 
128
  public function dashboard_stats() {
129
+ $user_status = $this->get_user_statuses();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  ?>
131
  <div>
132
+ <p><span style="font-weight:bold;"><a href="users.php?page=<?php print $this->_admin_page ?>"><?php _e( 'Users', $this->plugin_id ); ?></a></span>:
133
+ <?php foreach ( $user_status as $status => $users ) print count( $users ) . " $status&nbsp;&nbsp;&nbsp;"; ?>
134
  </p>
135
  </div>
136
  <?php
137
  }
138
 
139
  /**
140
+ * Create the view for the admin interface
141
  */
142
  public function approve_admin() {
143
+ if ( isset( $_GET['user'] ) && isset( $_GET['status'] ) ) {
144
+ echo '<div id="message" class="updated fade"><p>'.__( 'User successfully updated.', $this->plugin_id ).'</p></div>';
145
  }
146
  ?>
147
  <div class="wrap">
148
+ <h2><?php _e( 'User Registration Approval', $this->plugin_id ); ?></h2>
149
 
150
+ <h3><?php _e( 'User Management', $this->plugin_id ); ?></h3>
151
  <div id="pw_approve_tabs">
152
  <ul>
153
+ <li><a href="#pw_pending_users"><span><?php _e( 'Users Pending Approval', $this->plugin_id ); ?></span></a></li>
154
+ <li><a href="#pw_approved_users"><span><?php _e( 'Approved Users', $this->plugin_id ); ?></span></a></li>
155
+ <li><a href="#pw_denied_users"><span><?php _e( 'Denied Users', $this->plugin_id ); ?></span></a></li>
156
  </ul>
157
  <div id="pw_pending_users">
158
+ <?php $this->user_table( 'pending' ); ?>
159
  </div>
160
  <div id="pw_approved_users">
161
+ <?php $this->user_table( 'approved' ); ?>
162
  </div>
163
  <div id="pw_denied_users">
164
+ <?php $this->user_table( 'denied' ); ?>
165
  </div>
166
  </div>
167
  </div>
169
  }
170
 
171
  /**
172
+ * Output the table that shows the registered users grouped by status
173
+ *
174
+ * @param string $status the filter to use for which the users will be queried. Possible values are pending, approved, or denied.
175
  */
176
+ public function user_table( $status ) {
177
  global $current_user;
178
+
179
+ $approve = ( 'denied' == $status || 'pending' == $status );
180
+ $deny = ( 'approved' == $status || 'pending' == $status );
181
+
182
+ $user_status = $this->get_user_statuses();
183
+ $users = $user_status[$status];
184
+
185
+ if ( count( $users ) > 0 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  ?>
187
  <table class="widefat">
188
  <thead>
189
  <tr class="thead">
190
+ <th><?php _e( 'Username', $this->plugin_id ); ?></th>
191
+ <th><?php _e( 'Name', $this->plugin_id ); ?></th>
192
+ <th><?php _e( 'E-mail', $this->plugin_id ); ?></th>
193
+ <?php if ( 'pending' == $status ) { ?>
194
+ <th colspan="2" style="text-align: center"><?php _e( 'Actions', $this->plugin_id ); ?></th>
195
  <?php } else { ?>
196
+ <th style="text-align: center"><?php _e( 'Actions', $this->plugin_id ); ?></th>
197
  <?php } ?>
198
  </tr>
199
  </thead>
201
  <?php
202
  // show each of the users
203
  $row = 1;
204
+ foreach ( $users as $user ) {
205
+ $class = ( $row % 2 ) ? '' : ' class="alternate"';
206
  $avatar = get_avatar( $user->user_email, 32 );
207
+ if ( $approve ) {
208
+ $approve_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=approve';
209
+ $approve_link = wp_nonce_url( $approve_link, 'pw_new_user_approve_action_' . get_class( $this ) );
210
  }
211
+ if ( $deny ) {
212
+ $deny_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=deny';
213
+ $deny_link = wp_nonce_url( $deny_link, 'pw_new_user_approve_action_' . get_class( $this ) );
214
  }
215
  if ( current_user_can( 'edit_user', $user->ID ) ) {
216
  if ($current_user->ID == $user->ID) {
224
  }
225
 
226
  ?><tr <?php echo $class; ?>>
227
+ <td><?php echo $avatar . ' ' . $edit; ?></td>
228
+ <td><?php echo get_user_meta( $user->ID, 'first_name', true ) . ' ' . get_user_meta( $user->ID, 'last_name', true ); ?></td>
229
  <td><a href="mailto:<?php echo $user->user_email; ?>" title="<?php _e('email:', $this->plugin_id) ?> <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
230
+ <?php if ( $approve ) { ?>
231
+ <td align="center"><a href="<?php echo $approve_link; ?>" title="<?php _e( 'Approve', $this->plugin_id ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Approve', $this->plugin_id ); ?></a></td>
232
  <?php } ?>
233
+ <?php if ( $deny ) { ?>
234
+ <td align="center"><a href="<?php echo $deny_link; ?>" title="<?php _e( 'Deny', $this->plugin_id ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Deny', $this->plugin_id ); ?></a></td>
235
  <?php } ?>
236
  </tr><?php
237
  $row++;
242
  <?php
243
  } else {
244
  $status_i18n = $status;
245
+ if ( $status == 'approved' ) {
246
+ $status_i18n = __( 'approved', $this->plugin_id );
247
+ } else if ( $status == 'denied' ) {
248
+ $status_i18n = __( 'denied', $this->plugin_id );
249
+ } else if ( $status == 'pending' ) {
250
+ $status_i18n = __( 'pending', $this->plugin_id );
251
  }
252
 
253
+ echo '<p>'.sprintf( __( 'There are no users with a status of %s', $this->plugin_id ), $status_i18n ) . '</p>';
254
  }
255
  }
256
 
257
  /**
258
+ * Send an email to the admin to request approval
259
  */
260
+ public function send_approval_email( $user_login, $user_email, $errors ) {
261
+ if ( ! $errors->get_error_code() ) {
262
  /* check if already exists */
263
  $user_data = get_user_by( 'login', $user_login );
264
+ if ( ! empty( $user_data ) ){
265
+ $errors->add( 'registration_required' , __( 'User name already exists', $this->plugin_id ), 'message' );
266
  } else {
267
  /* send email to admin for approval */
268
+ $message = sprintf( __( '%1$s (%2$s) has requested a username at %3$s', $this->plugin_id ), $user_login, $user_email, get_option( 'blogname' ) ) . "\r\n\r\n";
269
+ $message .= get_option( 'siteurl' ) . "\r\n\r\n";
270
+ $message .= sprintf( __( 'To approve or deny this user access to %s go to', $this->plugin_id ), get_option( 'blogname' ) ) . "\r\n\r\n";
271
+ $message .= get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . "\r\n";
272
+
273
+ $message = apply_filters( 'new_user_approve_request_approval_message', $message, $user_login, $user_email );
274
+
275
+ $subject = sprintf( __( '[%s] User Approval', $this->plugin_id ), get_option( 'blogname' ) );
276
+ $subject = apply_filters( 'new_user_approve_request_approval_subject', $subject );
277
 
278
  // send the mail
279
+ wp_mail( get_option( 'admin_email' ), $subject, $message );
280
 
281
  // create the user
282
  $user_pass = wp_generate_password();
283
+ $user_id = wp_create_user( $user_login, $user_pass, $user_email );
284
  }
285
  }
286
  }
287
 
288
  /**
289
+ * Admin approval of user
290
  */
291
  public function approve_user() {
292
  global $wpdb;
294
  $user_id = (int) $_GET['user'];
295
  $user = new WP_User( $user_id );
296
 
297
+ $bypass_password_reset = apply_filters( 'new_user_approve_bypass_password_reset', false );
298
+
299
+ if ( ! $bypass_password_reset ) {
300
+ // reset password to know what to send the user
301
+ $new_pass = wp_generate_password();
302
+ $data = array(
303
+ 'user_pass' => md5($new_pass),
304
+ 'user_activation_key' => '',
305
+ );
306
+ $where = array(
307
+ 'ID' => $user->ID,
308
+ );
309
+ $wpdb->update($wpdb->users, $data, $where, array( '%s', '%s' ), array( '%d' ) );
310
+ }
311
 
312
+ wp_cache_delete( $user->ID, 'users' );
313
+ wp_cache_delete( $user->user_login, 'userlogins' );
314
 
315
  // send email to user telling of approval
316
+ $user_login = stripslashes( $user->user_login );
317
+ $user_email = stripslashes( $user->user_email );
318
 
319
  // format the message
320
+ $message = sprintf( __( 'You have been approved to access %s', $this->plugin_id ), get_option( 'blogname' ) ) . "\r\n";
321
+ $message .= sprintf( __( 'Username: %s', $this->plugin_id ), $user_login ) . "\r\n";
322
+ if ( ! $bypass_password_reset ) {
323
+ $message .= sprintf( __( 'Password: %s', $this->plugin_id ), $new_pass ) . "\r\n";
324
+ }
325
+ $message .= get_option( 'siteurl' ) . "/wp-login.php\r\n";
326
 
327
+ $message = apply_filters( 'new_user_approve_approve_user_message', $message, $user );
328
+
329
+ $subject = sprintf( __( '[%s] Registration Approved', $this->plugin_id ), get_option( 'blogname' ) );
330
+ $subject = apply_filters( 'new_user_approve_approve_user_subject', $subject );
331
+
332
  // send the mail
333
+ @wp_mail( $user_email, $subject, $message );
334
 
335
  // change usermeta tag in database to approved
336
+ update_user_meta( $user->ID, 'pw_user_status', 'approved' );
337
+
338
+ do_action( 'new_user_approve_user_approved', $user );
339
  }
340
 
341
  /**
342
+ * Admin denial of user
343
  */
344
  public function deny_user() {
345
  $user_id = (int) $_GET['user'];
346
  $user = new WP_User( $user_id );
347
 
348
  // send email to user telling of denial
349
+ $user_email = stripslashes( $user->user_email );
350
 
351
  // format the message
352
+ $message = sprintf( __( 'You have been denied access to %s', $this->plugin_id ), get_option( 'blogname' ) );
353
+ $message = apply_filters( 'new_user_approve_deny_user_message', $message, $user );
354
+
355
+ $subject = sprintf( __( '[%s] Registration Denied', $this->plugin_id ), get_option( 'blogname' ) );
356
+ $subject = apply_filters( 'new_user_approve_deny_user_subject', $subject );
357
 
358
  // send the mail
359
+ @wp_mail( $user_email, $subject, $message );
360
 
361
  // change usermeta tag in database to denied
362
+ update_user_meta( $user->ID, 'pw_user_status', 'denied' );
363
+
364
+ do_action( 'new_user_approve_user_denied', $user );
365
  }
366
 
367
  /**
368
+ * Display a message to the user after they have registered
369
  */
370
+ public function show_user_pending_message($errors) {
371
+ if ( ! empty( $_POST['redirect_to'] ) ) {
372
+ // if a redirect_to is set, honor it
373
+ wp_safe_redirect( $_POST['redirect_to'] );
374
+ exit();
375
+ }
376
+
377
+ // if there is an error already, let it do it's thing
378
  if ( $errors->get_error_code() )
379
  return $errors;
380
+
381
+ $message = sprintf( __( 'An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request.', $this->plugin_id ) );
382
+ $message .= sprintf( __( 'You will receive an email with instructions on what you will need to do next. Thanks for your patience.', $this->plugin_id ) );
383
+ $message = apply_filters( 'new_user_approve_pending_message', $message );
384
+
385
+ $errors->add( 'registration_required', $message, 'message' );
386
+
387
+ $success_message = __( 'Registration successful.', $this->plugin_id );
388
+ $success_message = apply_filters( 'new_user_approve_registration_message', $success_message );
389
+
390
+ if ( function_exists( 'login_header' ) ) {
391
+ login_header( __( 'Pending Approval', $this->plugin_id ), '<p class="message register">' . $success_message . '</p>', $errors );
392
+ login_footer();
393
+
394
+ // an exit is necessay here so the normal process for user registration doesn't happen
395
+ exit();
396
  }
 
 
 
397
  }
398
 
399
  /**
400
+ * Accept input from admin to modify a user
401
  */
402
  public function process_input() {
403
+ if ( ( isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) && isset( $_GET['status'] ) ) {
404
+ $valid_request = check_admin_referer( 'pw_new_user_approve_action_' . get_class( $this ) );
405
 
406
+ if ( $valid_request ) {
407
+ if ( $_GET['status'] == 'approve' ) {
408
+ do_action( 'new_user_approve_approve_user' );
409
  }
410
 
411
+ if ( $_GET['status'] == 'deny' ) {
412
+ do_action( 'new_user_approve_deny_user' );
413
  }
414
  }
415
  }
416
  }
417
 
418
  /**
419
+ * Only give a user their password if they have been approved
420
  */
421
  public function lost_password() {
422
+ $is_email = strpos( $_POST['user_login'], '@' );
423
+ if ( $is_email === false ) {
424
  $username = sanitize_user( $_POST['user_login'] );
425
  $user_data = get_user_by( 'login', trim( $username ) );
426
  } else {
428
  $user_data = get_user_by( 'email', $email );
429
  }
430
 
431
+ if ( $user_data->pw_user_status != 'approved' ) {
432
+ wp_redirect( 'wp-login.php' );
433
  exit();
434
  }
435
 
436
  return;
437
  }
438
 
439
+ /**
440
+ * Add message to login page saying registration is required.
441
+ *
442
+ * @param string $message
443
+ * @return string
444
+ */
445
  public function welcome_user($message) {
446
+ if ( ! isset( $_GET['action'] ) ) {
447
+ $welcome = sprintf( __( 'Welcome to %s. This site is accessible to approved users only. To be approved, you must first register.', $this->plugin_id ), get_option( 'blogname' ) );
448
+ $welcome = apply_filters( 'new_user_approve_welcome_message', $welcome );
449
+
450
+ $message .= '<p class="message">' . $welcome . '</p>';
451
  }
452
 
453
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && ! $_POST ) {
454
+ $instructions = sprintf( __( 'After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions.', $this->plugin_id ) );
455
+ $instructions = apply_filters( 'new_user_approve_register_instructions', $instructions );
456
+
457
+ $message .= '<p class="message">' . $instructions . '</p>';
458
  }
459
 
460
  return $message;
461
  }
462
 
463
+ /**
464
+ * Determine if the user is good to sign inbased on their status
465
+ *
466
+ * @param array $userdata
467
+ * @param string $password
468
+ */
 
 
 
 
 
 
469
  public function authenticate_user( $userdata, $password ) {
470
  $status = get_user_meta( $userdata->ID, 'pw_user_status', true );
471
 
477
  $message = false;
478
  switch ( $status ) {
479
  case 'pending':
480
+ $pending_message = __( '<strong>ERROR</strong>: Your account is still pending approval.' );
481
+ $pending_message = apply_filters( 'new_user_approve_pending_error', $pending_message );
482
+
483
+ $message = new WP_Error( 'pending_approval', $pending_message );
484
  break;
485
  case 'denied':
486
+ $denied_message = __( '<strong>ERROR</strong>: Your account has been denied access to this site.' );
487
+ $denied_message = apply_filters( 'new_user_approve_denied_error', $denied_message );
488
+
489
+ $message = new WP_Error( 'denied_access', $denied_message );
490
  break;
491
  case 'approved':
492
  $message = $userdata;
496
  return $message;
497
  }
498
 
499
+ /**
500
+ * Give the user a status
501
+ * @param int $user_id
502
+ */
503
  public function add_user_status( $user_id ) {
504
  $status = 'pending';
505
+ if ( isset( $_REQUEST['action'] ) && 'createuser' == $_REQUEST['action'] ) {
506
  $status = 'approved';
507
  }
508
  update_user_meta( $user_id, 'pw_user_status', $status );
509
  }
510
 
511
+ /**
512
+ * Get a status of all the users and save them using a transient
513
+ */
514
+ public function get_user_statuses() {
515
+ $valid_stati = array( 'pending', 'approved', 'denied' );
516
+ $user_status = get_transient( 'new_user_approve_user_statuses' );
517
+
518
+ if ( false === $user_status ) {
519
+ $user_status = array();
520
+
521
+ foreach ( $valid_stati as $status ) {
522
+ // Query the users table
523
+ if ( $status != 'approved' ) {
524
+ // Query the users table
525
+ $query = array(
526
+ 'meta_key' => 'pw_user_status',
527
+ 'meta_value' => $status,
528
+ );
529
+ $wp_user_search = new WP_User_Query( $query );
530
+ } else {
531
+ $users = get_users( 'blog_id=1' );
532
+ $approved_users = array();
533
+ foreach( $users as $user ) {
534
+ $the_status = get_user_meta( $user->ID, 'pw_user_status', true );
535
+
536
+ if ( $the_status == 'approved' || empty( $the_status ) ) {
537
+ $approved_users[] = $user->ID;
538
+ }
539
+ }
540
+
541
+ // get all approved users and any user without a status
542
+ $query = array( 'include' => $approved_users );
543
+ $wp_user_search = new WP_User_Query( $query );
544
+ }
545
+
546
+ $user_status[$status] = $wp_user_search->get_results();
547
+
548
+ set_transient( 'new_user_approve_user_statuses', $user_status );
549
+ }
550
+ }
551
+
552
+ foreach ( $valid_stati as $status ) {
553
+ $user_status[$status] = apply_filters( 'new_user_approve_user_status', $user_status[$status], $status );
554
+ }
555
+
556
+ return $user_status;
557
+ }
558
+
559
+ public function delete_new_user_approve_transient() {
560
+ delete_transient( 'new_user_approve_user_statuses' );
561
+ }
562
+
563
  } // End Class
564
  } // End if class exists statement
565
 
566
  // instantiate the class
567
+ if ( class_exists( 'pw_new_user_approve' ) ) {
568
  $pw_new_user_approve = new pw_new_user_approve();
569
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: picklewagon
3
  Donate link: http://picklewagon.com/wordpress/new-user-approve/donate
4
  Tags: users, registration
5
  Requires at least: 3.2.1
6
- Tested up to: 3.4
7
- Stable tag: 1.3.4
8
 
9
  New User Approve is a Wordpress plugin that allows a blog administrator to
10
  approve a user before they are able to access and login to the blog.
@@ -46,12 +46,32 @@ your liking.
46
  * [wp mail from](http://wordpress.org/extend/plugins/wp-mailfrom/)
47
  * [Mail From](http://wordpress.org/extend/plugins/mail-from/)
48
 
 
 
 
 
 
 
 
 
 
 
 
49
  == Screenshots ==
50
 
51
  1. The backend to manage approving and denying users.
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
 
 
 
 
55
  = 1.3.4 =
56
  * remove unused screen_layout_columns filter
57
  * tested with WordPress 3.4
@@ -143,19 +163,43 @@ Download version 1.3.2 immediately! A bug was found in version 1.3 that allows a
143
 
144
  == Other Notes ==
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  = Translations =
147
  The plugin has been prepared to be translated. If you want to help to translate the plugin to your language, please have a look at the localization/new-user-approve.pot file which contains all defintions and may be used with a gettext editor like Poedit (Windows). More information can be found on the [Codex](http://codex.wordpress.org/Translating_WordPress).
148
 
 
 
149
  * Belarusian translation by [Fat Cow](http://www.fatcow.com/)
 
 
 
150
  * Danish translation by [GeorgWP](http://wordpress.org/support/profile/georgwp)
 
 
151
  * French translation by [Philippe Scoffoni](http://philippe.scoffoni.net/)
152
- * Greek translation by [Leftys](http://alt3rnet.info/)
153
- * Polish translation by [pik256](http://wordpress.org/support/profile/1271256)
154
  * German translation by Christoph Ploedt
155
- * Spanish translation by [Eduardo Aranda](http://sinetiks.com/)
156
- * Dutch translation by [Ronald Moolenaar](http://profiles.wordpress.org/moolie/)
157
  * Italian translation by [Pierfrancesco Marsiaj](http://profiles.wordpress.org/pierinux/)
158
- * Czech translation by [GazikT](http://profiles.wordpress.org/gazikt/)
159
- * Catalan translation by [xoanet](http://profiles.wordpress.org/xoanet/)
160
  * Romanian translation by [Web Hosting Geeks](http://webhostinggeeks.com/)
161
-
 
3
  Donate link: http://picklewagon.com/wordpress/new-user-approve/donate
4
  Tags: users, registration
5
  Requires at least: 3.2.1
6
+ Tested up to: 3.4.2
7
+ Stable tag: 1.4
8
 
9
  New User Approve is a Wordpress plugin that allows a blog administrator to
10
  approve a user before they are able to access and login to the blog.
46
  * [wp mail from](http://wordpress.org/extend/plugins/wp-mailfrom/)
47
  * [Mail From](http://wordpress.org/extend/plugins/mail-from/)
48
 
49
+ = Why is the password reset when approving a user? =
50
+
51
+ The password is generated again because, by default, the user will not be aware
52
+ of their password. By generating a new password, the email that notifies the
53
+ user can also give them the new password just like the email does when recieving
54
+ your password on a regular WordPress install. At approval time, it is impossible
55
+ to retrieve the user's password.
56
+
57
+ There is a filter available (new_user_approve_bypass_password_reset) to turn off
58
+ this feature.
59
+
60
  == Screenshots ==
61
 
62
  1. The backend to manage approving and denying users.
63
 
64
  == Changelog ==
65
 
66
+ = 1.4 =
67
+ * add filters
68
+ * honor the redirect if there is one set when registering
69
+ * add actions for when a user is approved or denied
70
+ * add a filter to bypass password reset
71
+ * add more translations
72
+ * add user counts by status to dashboard
73
+ * store the users by status in a transient
74
+
75
  = 1.3.4 =
76
  * remove unused screen_layout_columns filter
77
  * tested with WordPress 3.4
163
 
164
  == Other Notes ==
165
 
166
+ = Filters =
167
+ * *new_user_approve_user_status* - modify the list of users shown in the tables
168
+ * *new_user_approve_request_approval_message* - modify the request approval message
169
+ * *new_user_approve_request_approval_subject* - modify the request approval subject
170
+ * *new_user_approve_approve_user_message* - modify the user approval message
171
+ * *new_user_approve_approve_user_subject* - modify the user approval subject
172
+ * *new_user_approve_deny_user_message* - modify the user denial message
173
+ * *new_user_approve_deny_user_subject* - modify the user denial subject
174
+ * *new_user_approve_pending_message* - modify message user sees after registration
175
+ * *new_user_approve_registration_message* - modify message after a successful registration
176
+ * *new_user_approve_register_instructions* - modify message that appears on registration screen
177
+ * *new_user_approve_pending_error* - error message shown to pending users when attempting to log in
178
+ * *new_user_approve_denied_error* - error message shown to denied users when attempting to log in
179
+
180
+ = Actions =
181
+ * *new_user_approve_user_approved* - after the user has been approved
182
+ * *new_user_approve_user_denied* - after the user has been denied
183
+ * *new_user_approve_approve_user* - when the user has been approved
184
+ * *new_user_approve_deny_user* - when the user has been denied
185
+
186
  = Translations =
187
  The plugin has been prepared to be translated. If you want to help to translate the plugin to your language, please have a look at the localization/new-user-approve.pot file which contains all defintions and may be used with a gettext editor like Poedit (Windows). More information can be found on the [Codex](http://codex.wordpress.org/Translating_WordPress).
188
 
189
+ When sending me your translation files, please send me your wordpress.org username as well.
190
+
191
  * Belarusian translation by [Fat Cow](http://www.fatcow.com/)
192
+ * Catalan translation by [xoanet](http://profiles.wordpress.org/xoanet/)
193
+ * Croation translation by Nik
194
+ * Czech translation by [GazikT](http://profiles.wordpress.org/gazikt/)
195
  * Danish translation by [GeorgWP](http://wordpress.org/support/profile/georgwp)
196
+ * Dutch translation by [Ronald Moolenaar](http://profiles.wordpress.org/moolie/)
197
+ * Finnish translation by Tonttu-ukko
198
  * French translation by [Philippe Scoffoni](http://philippe.scoffoni.net/)
 
 
199
  * German translation by Christoph Ploedt
200
+ * Greek translation by [Leftys](http://alt3rnet.info/)
 
201
  * Italian translation by [Pierfrancesco Marsiaj](http://profiles.wordpress.org/pierinux/)
202
+ * Polish translation by [pik256](http://wordpress.org/support/profile/1271256)
 
203
  * Romanian translation by [Web Hosting Geeks](http://webhostinggeeks.com/)
204
+ * Russion translation by [Alexey](http://wordpress.org/support/profile/asel)
205
+ * Spanish translation by [Eduardo Aranda](http://sinetiks.com/)