New User Approve - Version 1.3

Version Description

  • use the User API to retrieve a user instead of querying the db
  • require at least WordPress 3.1
  • add validate_user function to fix authentication problems
  • add new translations
  • get rid of plugin errors with WP_DEBUG set to true
Download this release

Release Info

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

Code changes from version 1.2.6 to 1.3

localization/new-user-approve-de_DE.mo ADDED
Binary file
localization/new-user-approve-de_DE.po ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 2010-02-09 21:16+0100\n"
12
+ "Last-Translator: Christoph Ploedt <christoph.ploedt@gmail.com>\n"
13
+ "Language-Team: FatCow <zhr@tut.by>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Belarusian\n"
18
+ "X-Poedit-Country: BELARUS\n"
19
+ "X-Poedit-SourceCharset: utf-8\n"
20
+
21
+ #: new-user-approve.php:126
22
+ msgid "Approve New Users"
23
+ msgstr "Neue Benutzer freischalten"
24
+
25
+ #: new-user-approve.php:140
26
+ msgid "Settings"
27
+ msgstr "Einstellungen"
28
+
29
+ #: new-user-approve.php:183
30
+ msgid "Users"
31
+ msgstr "Benutzer"
32
+
33
+ #: new-user-approve.php:219
34
+ msgid "User successfully updated."
35
+ msgstr "Der Benutzer wurde erfolgreich aktualisiert."
36
+
37
+ #: new-user-approve.php:223
38
+ msgid "User Registration Approval"
39
+ msgstr "Freischaltung der Benutzer-Registrierung"
40
+
41
+ #: new-user-approve.php:225
42
+ msgid "User Management"
43
+ msgstr "Benutzer-Verwaltung"
44
+
45
+ #: new-user-approve.php:228
46
+ msgid "Users Pending Approval"
47
+ msgstr "Ausstehende Genehmigung eines Benutzers"
48
+
49
+ #: new-user-approve.php:229
50
+ msgid "Approved Users"
51
+ msgstr "Zugelassene Benutzer"
52
+
53
+ #: new-user-approve.php:230
54
+ msgid "Denied Users"
55
+ msgstr "Abgelehnte Benutzer"
56
+
57
+ #: new-user-approve.php:255
58
+ msgid "ID"
59
+ msgstr "ID"
60
+
61
+ #: new-user-approve.php:256
62
+ msgid "Username"
63
+ msgstr "Benutzername"
64
+
65
+ #: new-user-approve.php:257
66
+ msgid "Name"
67
+ msgstr "Name"
68
+
69
+ #: new-user-approve.php:258
70
+ msgid "E-mail"
71
+ msgstr "E-Mail"
72
+
73
+ #: new-user-approve.php:260
74
+ #: new-user-approve.php:262
75
+ msgid "Actions"
76
+ msgstr "Aktionen"
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 "Freischalten"
85
+
86
+ #: new-user-approve.php:301
87
+ msgid "Deny"
88
+ msgstr "Ablehnen"
89
+
90
+ #: new-user-approve.php:313
91
+ msgid "approved"
92
+ msgstr "freigeschalten"
93
+
94
+ #: new-user-approve.php:315
95
+ msgid "denied"
96
+ msgstr "abgelehnt"
97
+
98
+ #: new-user-approve.php:317
99
+ msgid "pending"
100
+ msgstr "schwebend"
101
+
102
+ #: new-user-approve.php:320
103
+ #, php-format
104
+ msgid "There are no users with a status of %s"
105
+ msgstr "Es gibt keine Benutzer mit dem Status %s"
106
+
107
+ #: new-user-approve.php:332
108
+ msgid "User name already exists"
109
+ msgstr "Der Benutzername existiert bereits"
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) hat einen Benutzernamen um %3$s beantragt"
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 "Um den Benutzer zuzulassen oder abzulehnen gehe zu %s"
120
+
121
+ #: new-user-approve.php:341
122
+ #, php-format
123
+ msgid "[%s] User Approval"
124
+ msgstr "[%s] Genehmigung des Benutzers"
125
+
126
+ #: new-user-approve.php:372
127
+ #, php-format
128
+ msgid "You have been approved to access %s"
129
+ msgstr "Ihnen wurde der Zugang %s freigeschaltet"
130
+
131
+ #: new-user-approve.php:373
132
+ #, php-format
133
+ msgid "Username: %s"
134
+ msgstr "Benutzername: %s"
135
+
136
+ #: new-user-approve.php:374
137
+ #, php-format
138
+ msgid "Password: %s"
139
+ msgstr "Passwort: %s"
140
+
141
+ #: new-user-approve.php:378
142
+ #, php-format
143
+ msgid "[%s] Registration Approved"
144
+ msgstr "[%s] Registrierung wurde freigeschalten"
145
+
146
+ #: new-user-approve.php:397
147
+ #, php-format
148
+ msgid "You have been denied access to %s"
149
+ msgstr "Ihr Zugang zu %s wurde abgelehnt."
150
+
151
+ #: new-user-approve.php:400
152
+ #, php-format
153
+ msgid "[%s] Registration Denied"
154
+ msgstr "[%s] Registrierung abgelehnt"
155
+
156
+ #: new-user-approve.php:413
157
+ 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."
158
+ msgstr "Dem Administrator der Seite wurde eine E-Mail gesendet. Nach Prüfung durch diesen werden Ihnen die Zugangsdaten mitgeteilt."
159
+
160
+ #: new-user-approve.php:414
161
+ msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
162
+ msgstr "Sie erhalten eine E-Mail mit Anleitungen zum weiteren Vorgehen. Danke für Ihr Verständnis."
163
+
164
+ #: new-user-approve.php:418
165
+ msgid "Pending Approval"
166
+ msgstr "Ausstehende Freischaltung"
167
+
168
+ #: new-user-approve.php:418
169
+ msgid "Registration successful."
170
+ msgstr "Registrierung erfolgreich."
171
+
172
+ #: new-user-approve.php:466
173
+ #, php-format
174
+ msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
175
+ msgstr "Willkommen auf %s. Diese Seite ist nur registrierten Benutzern zugänglich. Für einen Zugriff müssen Sie sich zunächst registrieren."
176
+
177
+ #: new-user-approve.php:471
178
+ msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
179
+ msgstr "Nachdem Sie sich registriert haben, wird Ihre Registrierung zur Freischaltung an den Administrator der Seite geschickt. Sie erhalten dann eine E-Mail mit weiteren Anleitungen."
180
+
181
+ #. Plugin Name of an extension
182
+ msgid "New User Approve"
183
+ msgstr "Freischaltung eines neuen Benutzers"
184
+
185
+ #. Plugin URI of an extension
186
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
187
+ msgstr "http://www.picklewagon.com/wordpress/new-user-approve"
188
+
189
+ #. Description of an extension
190
+ msgid "This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog."
191
+ msgstr "Dieses Plugin erlaubt es Administratoren, Benutzer, die sich angemeldet haben, vor einem Zugang zum Blog zunächst freizuschalten."
192
+
193
+ #. Author of an extension
194
+ msgid "Josh Harrison"
195
+ msgstr "Josh Harrison"
196
+
197
+ #. Author URI of an extension
198
+ msgid "http://www.picklewagon.com/"
199
+ msgstr "http://www.picklewagon.com/"
200
+
localization/{pw_new_user_approve-el_EL.mo → new-user-approve-el_EL.mo} RENAMED
File without changes
localization/{pw_new_user_approve-el_EL.po → new-user-approve-el_EL.po} RENAMED
File without changes
localization/new-user-approve-es_ES.mo ADDED
Binary file
localization/new-user-approve-es_ES.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: PACKAGE VERSION\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: 2011-04-18 13:28-0600\n"
12
+ "Last-Translator: Eduardo Aranda <eduardo@sinetiks.com>\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 "Aprobar nuevos usuarios"
21
+
22
+ #: new-user-approve.php:140
23
+ msgid "Settings"
24
+ msgstr "Configuración"
25
+
26
+ #: new-user-approve.php:183
27
+ msgid "Users"
28
+ msgstr "Usuarios"
29
+
30
+ #: new-user-approve.php:219
31
+ msgid "User successfully updated."
32
+ msgstr "Usuario actualizado correctamente"
33
+
34
+ #: new-user-approve.php:223
35
+ msgid "User Registration Approval"
36
+ msgstr "Aprobación de nuevos usuarios"
37
+
38
+ #: new-user-approve.php:225
39
+ msgid "User Management"
40
+ msgstr "Administración de usuarios"
41
+
42
+ #: new-user-approve.php:228
43
+ msgid "Users Pending Approval"
44
+ msgstr "Usuarios pendientes de aprobación"
45
+
46
+ #: new-user-approve.php:229
47
+ msgid "Approved Users"
48
+ msgstr "Usuarios aprobados"
49
+
50
+ #: new-user-approve.php:230
51
+ msgid "Denied Users"
52
+ msgstr "Usuarios rechazados"
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 "Usuario"
61
+
62
+ #: new-user-approve.php:257
63
+ msgid "Name"
64
+ msgstr "Nombre"
65
+
66
+ #: new-user-approve.php:258
67
+ msgid "E-mail"
68
+ msgstr "Email"
69
+
70
+ #: new-user-approve.php:260
71
+ #: new-user-approve.php:262
72
+ msgid "Actions"
73
+ msgstr "Acciones"
74
+
75
+ #: new-user-approve.php:296
76
+ msgid "email:"
77
+ msgstr "email:"
78
+
79
+ #: new-user-approve.php:298
80
+ msgid "Approve"
81
+ msgstr "Aprobar"
82
+
83
+ #: new-user-approve.php:301
84
+ msgid "Deny"
85
+ msgstr "Rechazar"
86
+
87
+ #: new-user-approve.php:313
88
+ msgid "approved"
89
+ msgstr "aprobado"
90
+
91
+ #: new-user-approve.php:315
92
+ msgid "denied"
93
+ msgstr "rechazado"
94
+
95
+ #: new-user-approve.php:317
96
+ msgid "pending"
97
+ msgstr "Pendiente"
98
+
99
+ #: new-user-approve.php:320
100
+ #, php-format
101
+ msgid "There are no users with a status of %s"
102
+ msgstr "No hay usuarios con estatus %s"
103
+
104
+ #: new-user-approve.php:332
105
+ msgid "User name already exists"
106
+ msgstr "Nombre de usuario ya existe"
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) ha solicitado un nombre de usuario en %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 "Para aprobar o rechazar este usuario en %s vaya a"
117
+
118
+ #: new-user-approve.php:341
119
+ #, php-format
120
+ msgid "[%s] User Approval"
121
+ msgstr "[%s] Aprobación de usuario"
122
+
123
+ #: new-user-approve.php:372
124
+ #, php-format
125
+ msgid "You have been approved to access %s"
126
+ msgstr "Usted ha sido aprobado en %s"
127
+
128
+ #: new-user-approve.php:373
129
+ #, php-format
130
+ msgid "Username: %s"
131
+ msgstr "Usuario: %s"
132
+
133
+ #: new-user-approve.php:374
134
+ #, php-format
135
+ msgid "Password: %s"
136
+ msgstr "Password: %s"
137
+
138
+ #: new-user-approve.php:378
139
+ #, php-format
140
+ msgid "[%s] Registration Approved"
141
+ msgstr "[%s] Registro aprobado"
142
+
143
+ #: new-user-approve.php:397
144
+ #, php-format
145
+ msgid "You have been denied access to %s"
146
+ msgstr "Usted no ha sido aprobado en %s"
147
+
148
+ #: new-user-approve.php:400
149
+ #, php-format
150
+ msgid "[%s] Registration Denied"
151
+ msgstr "[%s] Registro rechazado"
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 "Un correo ha sido enviado al administrador del sitio. El administrador revisará la información que usted envió y aprobará o negará su solicitud."
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 "Usted recibirá un correo con instrucciones adicionales, gracias por su paciencia."
160
+
161
+ #: new-user-approve.php:418
162
+ msgid "Pending Approval"
163
+ msgstr "Aprobación pendiente"
164
+
165
+ #: new-user-approve.php:418
166
+ msgid "Registration successful."
167
+ msgstr "Registro exitoso"
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 "Bienvenido a %s. Este sitio está disponible únicamente a usuarios registrados, si desea entrar, primero debe registrarse."
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 "Después de registrarse, su solicitud será enviada al administrador del sitio para su aprobación. A continuación, recibirá un correo electrónico con instrucciones adicionales."
177
+
178
+ #. Plugin Name of an extension
179
+ msgid "New User Approve"
180
+ msgstr "Aprobación de nuevos usuarios"
181
+
182
+ #. Plugin URI of an extension
183
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
184
+ msgstr "http://www.picklewagon.com/wordpress/new-user-approve"
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 "Este plugin permite a los administradores aprobar nuevos usuarios una vez que se registran. Sólo los usuarios autorizados podrán acceder al sitio."
189
+
190
+ #. Author of an extension
191
+ msgid "Josh Harrison"
192
+ msgstr "Josh Harrison"
193
+
194
+ #. Author URI of an extension
195
+ msgid "http://www.picklewagon.com/"
196
+ msgstr "http://www.picklewagon.com/"
197
+
localization/new-user-approve-it_IT.mo ADDED
Binary file
localization/new-user-approve-it_IT.po ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ 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: 2011-01-08 13:15+0100\n"
7
+ "Last-Translator: Pierfrancesco Marsiaj <p_marsiaj@yahoo.it>\n"
8
+ "Language-Team: Philippe Scoffoni <philippe@scoffoni.net>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-Language: French\n"
13
+
14
+ #: new-user-approve.php:126
15
+ msgid "Approve New Users"
16
+ msgstr "Gestione Richieste"
17
+
18
+ #: new-user-approve.php:140
19
+ msgid "Settings"
20
+ msgstr "Impostazioni"
21
+
22
+ #: new-user-approve.php:183
23
+ msgid "Users"
24
+ msgstr "Utenti"
25
+
26
+ #: new-user-approve.php:219
27
+ msgid "User successfully updated."
28
+ msgstr "Utente correttamente aggiornato"
29
+
30
+ #: new-user-approve.php:223
31
+ msgid "User Registration Approval"
32
+ msgstr "Gestione delle Registrazioni"
33
+
34
+ #: new-user-approve.php:225
35
+ msgid "User Management"
36
+ msgstr "Gestione Utenti"
37
+
38
+ #: new-user-approve.php:228
39
+ msgid "Users Pending Approval"
40
+ msgstr "Utenti in attesa di Approvazione"
41
+
42
+ #: new-user-approve.php:229
43
+ msgid "Approved Users"
44
+ msgstr "Utenti Approvati"
45
+
46
+ #: new-user-approve.php:230
47
+ msgid "Denied Users"
48
+ msgstr "Utenti Bloccati"
49
+
50
+ #: new-user-approve.php:255
51
+ msgid "ID"
52
+ msgstr "ID"
53
+
54
+ #: new-user-approve.php:256
55
+ msgid "Username"
56
+ msgstr "Nome utente"
57
+
58
+ #: new-user-approve.php:257
59
+ msgid "Name"
60
+ msgstr "Nome"
61
+
62
+ #: new-user-approve.php:258
63
+ msgid "E-mail"
64
+ msgstr "E-mail"
65
+
66
+ #: new-user-approve.php:260
67
+ #: new-user-approve.php:262
68
+ msgid "Actions"
69
+ msgstr "Azioni"
70
+
71
+ #: new-user-approve.php:296
72
+ msgid "email:"
73
+ msgstr "email:"
74
+
75
+ #: new-user-approve.php:298
76
+ msgid "Approve"
77
+ msgstr "Approva"
78
+
79
+ #: new-user-approve.php:301
80
+ msgid "Deny"
81
+ msgstr "Blocca"
82
+
83
+ #: new-user-approve.php:313
84
+ msgid "approved"
85
+ msgstr "approvato"
86
+
87
+ #: new-user-approve.php:315
88
+ msgid "denied"
89
+ msgstr "bloccato"
90
+
91
+ #: new-user-approve.php:317
92
+ msgid "pending"
93
+ msgstr "in attesa"
94
+
95
+ #: new-user-approve.php:320
96
+ #, php-format
97
+ msgid "There are no users with a status of %s"
98
+ msgstr "Non ci sono utenti nello lo stato \"%s\""
99
+
100
+ #: new-user-approve.php:332
101
+ msgid "User name already exists"
102
+ msgstr "L'utente esiste già"
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) ha richiesto un nome utente a %3$s"
108
+
109
+ #: new-user-approve.php:337
110
+ #, php-format
111
+ msgid "To approve or deny this user access to %s go to"
112
+ msgstr "Per approvare o bloccare questo utente a %s vai su"
113
+
114
+ #: new-user-approve.php:341
115
+ #, php-format
116
+ msgid "[%s] User Approval"
117
+ msgstr "[%s] Approvazione Utente"
118
+
119
+ #: new-user-approve.php:372
120
+ #, php-format
121
+ msgid "You have been approved to access %s"
122
+ msgstr "Il vostro accesso a %s e' stato approvato."
123
+
124
+ #: new-user-approve.php:373
125
+ #, php-format
126
+ msgid "Username: %s"
127
+ msgstr "Nome utente : %s"
128
+
129
+ #: new-user-approve.php:374
130
+ #, php-format
131
+ msgid "Password: %s"
132
+ msgstr "Password: %s"
133
+
134
+ #: new-user-approve.php:378
135
+ #, php-format
136
+ msgid "[%s] Registration Approved"
137
+ msgstr "[%s] Registrazione Approvata"
138
+
139
+ #: new-user-approve.php:397
140
+ #, php-format
141
+ msgid "You have been denied access to %s"
142
+ msgstr "Vi è stato negato l'accesso a %s"
143
+
144
+ #: new-user-approve.php:400
145
+ #, php-format
146
+ msgid "[%s] Registration Denied"
147
+ msgstr "[%s] Registrazione Negata"
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 "Una email con la vostra richiesta è stata spedita all'amministratore del sito. Dopo averla controllata l'amministratore deciderà se approvarla o negarla."
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."
155
+ msgstr "Riceverete una email con ulteriori istruzioni su come procedere. Grazie della vostra pazienza. "
156
+
157
+ #: new-user-approve.php:418
158
+ msgid "Pending Approval"
159
+ msgstr "Richiesta in Attesa"
160
+
161
+ #: new-user-approve.php:418
162
+ msgid "Registration successful."
163
+ msgstr "Registrazione richiesta."
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 "Benvenuto su  %s. Questo sito è accessibile soltanto ad utenti registrati e approvati da un amministratore. Per chiedere un accesso dovete prima registrarvi."
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 "Dopo esservi registrati la vostra richiesta sarà spedita ad un amministratore. Riceverete ulteriori istruzioni su come procedere via email."
173
+
174
+ #. Plugin Name of an extension
175
+ msgid "New User Approve"
176
+ msgstr "Approvazione Nuovo Utente"
177
+
178
+ #. Plugin URI of an extension
179
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
180
+ msgstr "http://www.picklewagon.com/wordpress/new-user-approve"
181
+
182
+ #. Description of an extension
183
+ msgid "This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog."
184
+ msgstr "Questo plugin permette agli amministratori di approvare le richieste di registrazione degli utenti. Solo gli utenti approvati potranno accedere al blog."
185
+
186
+ #. Author of an extension
187
+ msgid "Josh Harrison"
188
+ msgstr "Josh Harrison"
189
+
190
+ #. Author URI of an extension
191
+ msgid "http://www.picklewagon.com/"
192
+ msgstr "http://www.picklewagon.com/"
193
+
localization/new-user-approve-nl_NL.mo ADDED
Binary file
localization/new-user-approve-nl_NL.po ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 v1.2.6\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: 2011-11-26 23:12+0100\n"
12
+ "Last-Translator: Ronald Moolenaar <m00lie@hotmail.com>\n"
13
+ "Language-Team: \n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: Dutch\n"
18
+ "X-Poedit-Country: NETHERLANDS\n"
19
+ "X-Poedit-SourceCharset: iso-8859-1\n"
20
+
21
+ #: new-user-approve.php:126
22
+ msgid "Approve New Users"
23
+ msgstr "Goedkeuren nieuwe gebruikers"
24
+
25
+ #: new-user-approve.php:140
26
+ msgid "Settings"
27
+ msgstr "Instellingen"
28
+
29
+ #: new-user-approve.php:183
30
+ msgid "Users"
31
+ msgstr "Gebruikers"
32
+
33
+ #: new-user-approve.php:219
34
+ msgid "User successfully updated."
35
+ msgstr "Gebruiker succesvol bijgewerkt."
36
+
37
+ #: new-user-approve.php:223
38
+ msgid "User Registration Approval"
39
+ msgstr "Goedkeuring gebruikersregistratie"
40
+
41
+ #: new-user-approve.php:225
42
+ msgid "User Management"
43
+ msgstr "Gebruikersbeheer"
44
+
45
+ #: new-user-approve.php:228
46
+ msgid "Users Pending Approval"
47
+ msgstr "Gebruikers in behandeling"
48
+
49
+ #: new-user-approve.php:229
50
+ msgid "Approved Users"
51
+ msgstr "Goedgekeurde gebruikers"
52
+
53
+ #: new-user-approve.php:230
54
+ msgid "Denied Users"
55
+ msgstr "Geweigerde gebruikers"
56
+
57
+ #: new-user-approve.php:255
58
+ msgid "ID"
59
+ msgstr "ID"
60
+
61
+ #: new-user-approve.php:256
62
+ msgid "Username"
63
+ msgstr "Gebruikersnaam"
64
+
65
+ #: new-user-approve.php:257
66
+ msgid "Name"
67
+ msgstr "Naam"
68
+
69
+ #: new-user-approve.php:258
70
+ msgid "E-mail"
71
+ msgstr "E-mail"
72
+
73
+ #: new-user-approve.php:260
74
+ #: new-user-approve.php:262
75
+ msgid "Actions"
76
+ msgstr "Acties"
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 "Goedkeuren"
85
+
86
+ #: new-user-approve.php:301
87
+ msgid "Deny"
88
+ msgstr "Weigeren"
89
+
90
+ #: new-user-approve.php:313
91
+ msgid "approved"
92
+ msgstr "goedgekeurd"
93
+
94
+ #: new-user-approve.php:315
95
+ msgid "denied"
96
+ msgstr "geweigerd"
97
+
98
+ #: new-user-approve.php:317
99
+ msgid "pending"
100
+ msgstr "in behandeling"
101
+
102
+ #: new-user-approve.php:320
103
+ #, php-format
104
+ msgid "There are no users with a status of %s"
105
+ msgstr "Er zijn geen gebruikers met de status %s"
106
+
107
+ #: new-user-approve.php:332
108
+ msgid "User name already exists"
109
+ msgstr "Gebruikersnaam bestaat reeds"
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) heeft een gebruikersnaam aangevraagd om %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 "Om deze gebruiker wel of geen toegang te geven tot %s gaat u naar"
120
+
121
+ #: new-user-approve.php:341
122
+ #, php-format
123
+ msgid "[%s] User Approval"
124
+ msgstr "[%s] Goedkeuring gebruiker"
125
+
126
+ #: new-user-approve.php:372
127
+ #, php-format
128
+ msgid "You have been approved to access %s"
129
+ msgstr "Uw aanvraag voor toegang tot %s is goedgekeurd"
130
+
131
+ #: new-user-approve.php:373
132
+ #, php-format
133
+ msgid "Username: %s"
134
+ msgstr "Gebruikersnaam: %s"
135
+
136
+ #: new-user-approve.php:374
137
+ #, php-format
138
+ msgid "Password: %s"
139
+ msgstr "Wachtwoord: %s"
140
+
141
+ #: new-user-approve.php:378
142
+ #, php-format
143
+ msgid "[%s] Registration Approved"
144
+ msgstr "[%s] Registratie goedgekeurd"
145
+
146
+ #: new-user-approve.php:397
147
+ #, php-format
148
+ msgid "You have been denied access to %s"
149
+ msgstr "Uw aanvraag voor toegang tot %s is geweigerd"
150
+
151
+ #: new-user-approve.php:400
152
+ #, php-format
153
+ msgid "[%s] Registration Denied"
154
+ msgstr "[%s] Registratie geweigerd"
155
+
156
+ #: new-user-approve.php:413
157
+ 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."
158
+ msgstr "Er is een email gestuurd naar de beheerder van de website. De beheerder zal uw aanvraag beoordelen en deze goedkeuren of afwijzen."
159
+
160
+ #: new-user-approve.php:414
161
+ msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
162
+ msgstr "U ontvangt een email met verdere instructies. Dank u voor uw geduld."
163
+
164
+ #: new-user-approve.php:418
165
+ msgid "Pending Approval"
166
+ msgstr "Goedkeuring nog in behandeling"
167
+
168
+ #: new-user-approve.php:418
169
+ msgid "Registration successful."
170
+ msgstr "Registratie succesvol"
171
+
172
+ #: new-user-approve.php:466
173
+ #, php-format
174
+ msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
175
+ msgstr "Welkom op %s. Deze website is alleen toegankelijk voor goedgekeurde gebruikers. Om goedgekeurd te worden moet u uwzelf eerst registreren."
176
+
177
+ #: new-user-approve.php:471
178
+ msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
179
+ msgstr "Na registratie wordt uw aanvraag naar de beheerder van de website gestuurd ter goedkeuring. U ontvangt dan een email met verdere instructies."
180
+
181
+ #. Plugin Name of an extension
182
+ msgid "New User Approve"
183
+ msgstr "Goedkeuring nieuwe gebruiker"
184
+
185
+ #. Plugin URI of an extension
186
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
187
+ msgstr "http://www.picklewagon.com/wordpress/new-user-approve"
188
+
189
+ #. Description of an extension
190
+ msgid "This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog."
191
+ msgstr "Deze plugin stelt beheerders in staat om gebruikers goed te keuren na registratie. Alleen goedgekeurde gebruikers mogen het blog gebruiken."
192
+
193
+ #. Author of an extension
194
+ msgid "Josh Harrison"
195
+ msgstr "Josh Harrison"
196
+
197
+ #. Author URI of an extension
198
+ msgid "http://www.picklewagon.com/"
199
+ msgstr "http://www.picklewagon.com/"
200
+
new-user-approve.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
  Plugin Name: New User Approve
4
- Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve-wordpress-plugin/
5
  Description: This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog.
6
  Author: Josh Harrison
7
- Version: 1.2.6
8
  Author URI: http://www.picklewagon.com/
9
  */
10
-
11
  /** Copyright 2009
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
@@ -25,117 +25,62 @@
25
  */
26
 
27
  if (!class_exists('pw_new_user_approve')) {
28
- class pw_new_user_approve {
29
- /**
30
- * @var string The options string name for this plugin
31
- */
32
- var $optionsName = 'pw_new_user_approve_options';
33
-
34
- /**
35
- * @var string $localizationDomain Domain used for localization
36
- */
37
- var $localizationDomain = 'new-user-approve';
38
-
39
- /**
40
- * @var string $pluginurl The url to this plugin
41
- */
42
- var $pluginurl = '';
43
-
44
- /**
45
- * @var string $pluginpath The path to this plugin
46
- */
47
- var $pluginpath = '';
48
-
49
- /**
50
- * @var array $options Stores the options for this plugin
51
- */
52
- var $options = array();
53
-
54
- // Class Functions
55
- /**
56
- * PHP 4 Compatible Constructor
57
- */
58
- function pw_new_user_approve() {
59
- $this->__construct();
60
- }
61
 
62
- /**
63
- * PHP 5 Constructor
64
- */
65
- function __construct() {
66
- // Load up the localization file if we're using WordPress in a different language
67
- // Just drop it in this plugin's "localization" folder and name it "new-user-approve-[value in wp-config].mo"
68
- load_plugin_textdomain($this->localizationDomain, false, dirname(plugin_basename(__FILE__)) . '/localization');
69
-
70
- // Constants setup
71
- $this->pluginurl = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)).'/';
72
- $this->pluginpath = WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)).'/';
73
-
74
- // Initialize the options
75
- $this->get_options();
76
-
77
- // Actions
78
- add_action('admin_menu', array(&$this, 'admin_menu_link'));
79
- add_action('admin_footer', array(&$this, 'admin_scripts_footer'));
80
- add_action('init', array(&$this, 'init'));
81
- add_action('register_post', array(&$this, 'send_approval_email'), 10, 3);
82
- add_action('init', array(&$this, 'process_input'));
83
- add_action('lostpassword_post', array(&$this, 'lost_password'));
84
- add_filter('registration_errors', array(&$this, 'show_user_message'), 10, 1);
85
- add_filter('login_message', array(&$this, 'welcome_user'));
86
- //add_action('rightnow_end', array(&$this, 'dashboard_stats')); // still too slow
87
- }
88
 
89
- /**
90
- * Retrieves the plugin options from the database.
91
- */
92
- function get_options() {
93
- // Don't forget to set up the default options
94
- if (!$theOptions = get_option($this->optionsName)) {
95
- $theOptions = array(
96
- 'default' => 'options'
97
- );
98
- update_option($this->optionsName, $theOptions);
99
- }
100
- $this->options = $theOptions;
101
- }
102
-
103
- /**
104
- * @desc Saves the admin options to the database.
105
- */
106
- function save_admin_options(){
107
- update_option($this->optionsName, $this->options);
108
- }
109
 
110
- /**
111
- * @desc Adds the options subpanel
112
- */
113
- function admin_menu_link() {
114
- add_submenu_page('users.php', __('Approve New Users', $this->localizationDomain), __('Approve New Users', $this->localizationDomain), 'edit_users', basename(__FILE__), array(&$this, 'approve_admin'));
115
- add_filter('plugin_action_links', array(&$this, 'filter_plugin_actions'), 10, 2);
116
- }
117
 
118
- /**
119
- * @desc Adds the Settings link to the plugin activate/deactivate page
120
- */
121
- function filter_plugin_actions($links, $file) {
122
- static $this_plugin;
123
- if (!$this_plugin) {
124
- $this_plugin = plugin_basename(__FILE__);
125
- }
 
126
 
127
- if ($file == $this_plugin){
128
- $settings_link = '<a href="users.php?page=' . basename(__FILE__) . '">' . __('Settings', $this->localizationDomain) . '</a>';
129
- array_unshift( $links, $settings_link ); // before other links
130
- }
131
- return $links;
 
 
 
 
 
 
 
 
 
132
  }
 
 
 
 
133
 
134
- function admin_scripts_footer() {
135
- global $wp_db_version;
136
-
137
- if (WP_ADMIN && $_GET['page'] == basename(__FILE__)) {
138
- $page_id = ($wp_db_version >= 10851) ? '#pw_approve_tabs' : '#pw_approve_tabs > ul';
139
  ?>
140
  <script type="text/javascript">
141
  //<![CDATA[
@@ -145,356 +90,381 @@ if (!class_exists('pw_new_user_approve')) {
145
  //]]>
146
  </script>
147
  <?php
148
- }
149
  }
150
-
151
- function dashboard_stats() {
152
- // Query the users table
153
- $wp_user_search = new PW_User_Search($_GET['usersearch'], $_GET['userspage']);
154
- $user_status = array();
155
-
156
- // Make the user objects
157
- foreach ($wp_user_search->get_results() as $userid) {
158
- $user = new WP_User($userid);
 
 
 
 
159
  $status = get_usermeta($userid, 'pw_user_status');
160
- if ($status == '') { // user was created in admin
161
- update_usermeta($userid, 'pw_user_status', 'approved');
162
- $status = get_usermeta($userid, 'pw_user_status');
163
- }
164
- if ($user_status[$status] == null) {
165
- $user_status[$status] = 0;
166
- }
167
- $user_status[$status] += 1;
168
  }
 
 
 
 
 
169
  ?>
170
  <div>
171
- <p><span style="font-weight:bold;"><a href="users.php?page=<?php print basename(__FILE__) ?>"><?php _e('Users', $this->localizationDomain) ?></a></span>:
172
  <?php foreach($user_status as $status =>$count) print "$count $status&nbsp;&nbsp;"; ?>
173
  </p>
174
  </div>
175
  <?php
 
 
 
 
 
 
 
 
176
  }
177
-
178
- /**
179
- * @desc create the view for the admin interface
180
- */
181
- function approve_admin() {
182
- global $current_user;
183
-
184
- // Query the users table
185
- $wp_user_search = new PW_User_Search($_GET['usersearch'], $_GET['userspage']);
186
- $user_status = array();
187
-
188
- // Make the user objects
189
- foreach ($wp_user_search->get_results() as $userid) {
190
- $user = wp_cache_get($userid, 'pw_user_status_cache');
191
-
192
- if (!$user) {
193
- $user = new WP_User($userid);
194
- $status = get_usermeta($userid, 'pw_user_status');
195
- if ($status == '') { // user was created in admin
196
- update_usermeta($userid, 'pw_user_status', 'approved');
197
- $status = get_usermeta($userid, 'pw_user_status');
198
- }
199
- $user->status = $status;
200
- wp_cache_add($userid, $user, 'pw_user_status_cache');
201
- }
202
-
203
- $user_status[$status][] = $user;
204
- }
205
-
206
- if (isset($_GET['user']) && isset($_GET['status'])) {
207
- echo '<div id="message" class="updated fade"><p>'.__('User successfully updated.', $this->localizationDomain).'</p></div>';
208
- }
209
  ?>
210
- <div class="wrap">
211
- <h2><?php _e('User Registration Approval', $this->localizationDomain) ?></h2>
212
-
213
- <h3><?php _e('User Management', $this->localizationDomain) ?></h3>
214
- <div id="pw_approve_tabs">
215
- <ul>
216
- <li><a href="#pw_pending_users"><span><?php _e('Users Pending Approval', $this->localizationDomain) ?></span></a></li>
217
- <li><a href="#pw_approved_users"><span><?php _e('Approved Users', $this->localizationDomain) ?></span></a></li>
218
- <li><a href="#pw_denied_users"><span><?php _e('Denied Users', $this->localizationDomain) ?></span></a></li>
219
- </ul>
220
- <div id="pw_pending_users">
221
- <?php $this->approve_table($user_status, 'pending', true, true); ?>
222
- </div>
223
- <div id="pw_approved_users">
224
- <?php $this->approve_table($user_status, 'approved', false, true); ?>
225
- </div>
226
- <div id="pw_denied_users">
227
- <?php $this->approve_table($user_status, 'denied', true, false); ?>
228
- </div>
229
  </div>
230
  </div>
 
231
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  }
233
 
234
- /**
235
- * @desc the table that shows the registered users grouped by status
236
- */
237
- function approve_table($users, $status, $approve, $deny) {
238
- if (count($users[$status]) > 0) {
239
  ?>
240
  <table class="widefat">
241
  <thead>
242
  <tr class="thead">
243
- <th><?php _e('ID', $this->localizationDomain) ?></th>
244
- <th><?php _e('Username', $this->localizationDomain) ?></th>
245
- <th><?php _e('Name', $this->localizationDomain) ?></th>
246
- <th><?php _e('E-mail', $this->localizationDomain) ?></th>
247
  <?php if ($approve && $deny) { ?>
248
- <th colspan="2" style="text-align: center"><?php _e('Actions', $this->localizationDomain) ?></th>
249
  <?php } else { ?>
250
- <th style="text-align: center"><?php _e('Actions', $this->localizationDomain) ?></th>
251
  <?php } ?>
252
  </tr>
253
  </thead>
254
  <tbody>
255
  <?php
256
- // show each of the users
257
- $row = 1;
258
- foreach ($users[$status] as $user) {
259
- $class = ($row % 2) ? '' : ' class="alternate"';
260
- $avatar = get_avatar( $user->user_email, 32 );
261
- if ($approve) {
262
- $approve_link = get_option('siteurl').'/wp-admin/users.php?page='.basename(__FILE__).'&user='.$user->ID.'&status=approve';
263
- $approve_link = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($approve_link, 'plugin-name-action_' . get_class($this)) : $approve_link;
 
 
 
 
 
 
 
 
 
 
264
  }
265
- if ($deny) {
266
- $deny_link = get_option('siteurl').'/wp-admin/users.php?page='.basename(__FILE__).'&user='.$user->ID.'&status=deny';
267
- $deny_link = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($deny_link, 'plugin-name-action_' . get_class($this)) : $deny_link;
268
- }
269
- if ( current_user_can( 'edit_user', $user->ID ) ) {
270
- if ($current_user->ID == $user->ID) {
271
- $edit_link = 'profile.php';
272
- } else {
273
- $edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user->ID" ) );
274
- }
275
- $edit = '<strong><a href="' . $edit_link . '">' . $user->user_login . '</a></strong><br />';
276
- } else {
277
- $edit = '<strong>' . $user->user_login . '</strong>';
278
- }
279
-
280
- ?><tr <?php echo $class; ?>>
281
- <td><?php echo $user->ID; ?></td>
282
- <td><?php echo $avatar." ".$edit; ?></td>
283
- <td><?php echo $user->first_name." ".$user->last_name; ?></td>
284
- <td><a href="mailto:<?php echo $user->user_email; ?>" title="<?php _e('email:', $this->localizationDomain) ?> <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
285
- <?php if ($approve) { ?>
286
- <td align="center"><a href="<?php echo $approve_link; ?>" title="<?php _e('Approve', $this->localizationDomain) ?> <?php echo $user->user_login; ?>"><?php _e('Approve', $this->localizationDomain) ?></a></td>
287
- <?php } ?>
288
- <?php if ($deny) { ?>
289
- <td align="center"><a href="<?php echo $deny_link; ?>" title="<?php _e('Deny', $this->localizationDomain) ?> <?php echo $user->user_login; ?>"><?php _e('Deny', $this->localizationDomain) ?></a></td>
290
- <?php } ?>
291
- </tr><?php
292
- $row++;
293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  ?>
295
  </tbody>
296
  </table>
297
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  } else {
299
- $status_i18n = $status;
300
- if ($status == 'approved') {
301
- $status_i18n = __('approved', $this->localizationDomain);
302
- } else if ($status == 'denied') {
303
- $status_i18n = __('denied', $this->localizationDomain);
304
- } else if ($status == 'pending') {
305
- $status_i18n = __('pending', $this->localizationDomain);
306
- }
307
-
308
- echo '<p>'.sprintf(__('There are no users with a status of %s', $this->localizationDomain), $status_i18n).'</p>';
 
 
309
  }
310
  }
311
-
312
- /**
313
- * @desc send an email to the admin to request approval
314
- */
315
- function send_approval_email($user_login, $user_email, $errors) {
316
- if (!$errors->get_error_code()) {
317
- /* check if already exists */
318
- $user_data = get_userdatabylogin($user_login);
319
- if (!empty($user_data)){
320
- $errors->add('registration_required' , __('User name already exists', $this->localizationDomain), 'message');
321
- } else {
322
- /* send email to admin for approval */
323
- $message = sprintf(__('%1$s (%2$s) has requested a username at %3$s', $this->localizationDomain), $user_login, $user_email, get_option('blogname')) . "\r\n\r\n";
324
- $message .= get_option('siteurl') . "\r\n\r\n";
325
- $message .= sprintf(__('To approve or deny this user access to %s go to', $this->localizationDomain), get_option('blogname')) . "\r\n\r\n";
326
- $message .= get_option('siteurl') . "/wp-admin/users.php?page=".basename(__FILE__)."\r\n";
327
-
328
- // send the mail
329
- @wp_mail(get_option('admin_email'), sprintf(__('[%s] User Approval', $this->localizationDomain), get_option('blogname')), $message);
330
-
331
- // create the user
332
- $user_pass = wp_generate_password();
333
- $user_id = wp_create_user($user_login, $user_pass, $user_email);
334
-
335
- update_usermeta($user_id, 'pw_user_status', 'pending');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  }
337
  }
338
  }
339
-
340
- /**
341
- * @desc admin approval of user
342
- */
343
- function approve_user() {
344
- global $wpdb;
345
-
346
- $query = $wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d", $_GET['user']);
347
- $user = $wpdb->get_row($query);
348
-
349
- // reset password to know what to send the user
350
- $new_pass = wp_generate_password();
351
- $data = array(
352
- 'user_pass' => md5($new_pass),
353
- 'user_activation_key' => '',
354
- );
355
- $where = array(
356
- 'ID' => $user->ID,
357
- );
358
- $wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d'));
359
-
360
- wp_cache_delete($user->ID, 'users');
361
- wp_cache_delete($user->user_login, 'userlogins');
362
-
363
- // send email to user telling of approval
364
- $user_login = stripslashes($user->user_login);
365
- $user_email = stripslashes($user->user_email);
366
-
367
- // format the message
368
- $message = sprintf(__('You have been approved to access %s', $this->localizationDomain), get_option('blogname')) . "\r\n";
369
- $message .= sprintf(__('Username: %s', $this->localizationDomain), $user_login) . "\r\n";
370
- $message .= sprintf(__('Password: %s', $this->localizationDomain), $new_pass) . "\r\n";
371
- $message .= get_option('siteurl') . "/wp-login.php\r\n";
372
-
373
- // send the mail
374
- @wp_mail($user_email, sprintf(__('[%s] Registration Approved', $this->localizationDomain), get_option('blogname')), $message);
375
-
376
- // change usermeta tag in database to approved
377
- update_usermeta($user->ID, 'pw_user_status', 'approved');
378
- }
379
 
380
- /**
381
- * @desc admin denial of user
382
- */
383
- function deny_user() {
384
- global $wpdb;
385
-
386
- $query = $wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d", $_GET['user']);
387
- $user = $wpdb->get_row($query);
388
-
389
- // send email to user telling of denial
390
- $user_email = stripslashes($user->user_email);
391
-
392
- // format the message
393
- $message = sprintf(__('You have been denied access to %s', $this->localizationDomain), get_option('blogname'));
394
-
395
- // send the mail
396
- @wp_mail($user_email, sprintf(__('[%s] Registration Denied', $this->localizationDomain), get_option('blogname')), $message);
397
-
398
- // change usermeta tag in database to denied
399
- update_usermeta($user->ID, 'pw_user_status', 'denied');
400
  }
401
-
402
- /**
403
- * @desc display a message to the user if they have not been approved
404
- */
405
- function show_user_message($errors) {
406
- if ( $errors->get_error_code() )
407
- return $errors;
408
-
409
- $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->localizationDomain));
410
- $message .= sprintf(__('You will receive an email with instructions on what you will need to do next. Thanks for your patience.', $this->localizationDomain));
411
-
412
- $errors->add('registration_required', $message, 'message');
413
-
414
- if (function_exists('login_header')) {
415
- login_header(__('Pending Approval', $this->localizationDomain), '<p class="message register">' . __("Registration successful.", $this->localizationDomain) . '</p>', $errors);
416
- }
417
-
418
- echo "<body></html>";
419
  exit();
420
  }
421
-
422
- /**
423
- * @desc accept input from admin to modify a user
424
- */
425
- function process_input() {
426
- if ($_GET['page'] == basename(__FILE__) && isset($_GET['status'])) {
427
- $valid_request = check_admin_referer('plugin-name-action_' . get_class($this));
428
-
429
- if ($valid_request) {
430
- if ($_GET['status'] == 'approve') {
431
- $this->approve_user();
432
- }
433
-
434
- if ($_GET['status'] == 'deny') {
435
- $this->deny_user();
436
- }
437
- }
438
- }
439
  }
440
-
441
- /**
442
- * @desc only give a user their password if they have been approved
443
- */
444
- function lost_password() {
445
- $is_email = strpos($_POST['user_login'], '@');
446
- if ($is_email === false) {
447
- $username = sanitize_user($_POST['user_login']);
448
- $user_data = get_userdatabylogin(trim($username));
449
- } else {
450
- $email = is_email($_POST['user_login']);
451
- $user_data = get_user_by_email($email);
452
- }
453
-
454
- if ($user_data->pw_user_status != 'approved') {
455
- wp_redirect('wp-login.php');
456
- exit();
457
- }
458
-
 
 
 
459
  return;
460
  }
461
-
462
- function welcome_user($message) {
463
- if (!isset($_GET['action'])) {
464
- $inside = sprintf(__('Welcome to %s. This site is accessible to approved users only. To be approved, you must first register.', $this->localizationDomain), get_option('blogname'));
465
- $message .= '<p class="message">' . $inside . '</p>';
466
- }
467
-
468
- if ($_GET['action'] == 'register' && !$_POST) {
469
- $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->localizationDomain));
470
- $message .= '<p class="message">' . $inside . '</p>';
471
- }
472
-
473
- return $message;
474
  }
475
-
476
- function init() {
477
- if (WP_ADMIN && $_GET['page'] == basename(__FILE__)) {
478
- wp_enqueue_script('jquery-ui-tabs');
479
- wp_enqueue_style('pw-admin-ui-tabs', $this->pluginurl.'ui.tabs.css');
480
- }
 
 
 
 
 
 
481
  }
482
- } // End Class
483
- } // End if class exists statement
484
 
485
- if (!class_exists('WP_User_Search')) {
486
- if (version_compare($wp_version, "3.1", '>=')) {
487
- require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
488
- } else {
489
- require_once(ABSPATH . 'wp-admin/includes/user.php');
490
  }
491
- }
492
- class PW_User_Search extends WP_User_Search {
493
- var $users_per_page = 999999999;
494
- }
 
 
 
 
 
 
 
495
 
496
  // instantiate the class
497
  if (class_exists('pw_new_user_approve')) {
498
  $pw_new_user_approve = new pw_new_user_approve();
499
  }
500
- ?>
1
  <?php
2
  /*
3
  Plugin Name: New User Approve
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.
6
  Author: Josh Harrison
7
+ Version: 1.3
8
  Author URI: http://www.picklewagon.com/
9
  */
10
+
11
  /** Copyright 2009
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
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
31
+ */
32
+ var $plugin_id = 'new-user-approve';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ // Class Functions
35
+ /**
36
+ * PHP 4 Compatible Constructor
37
+ */
38
+ public function pw_new_user_approve() {
39
+ $this->__construct();
40
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
+ /**
43
+ * PHP 5 Constructor
44
+ */
45
+ public function __construct() {
46
+ // Load up the localization file if we're using WordPress in a different language
47
+ // Just drop it in this plugin's "localization" folder and name it "new-user-approve-[value in wp-config].mo"
48
+ load_plugin_textdomain($this->plugin_id, false, dirname(plugin_basename(__FILE__)) . '/localization');
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ register_activation_hook(__FILE__, array( $this, 'activation_check'));
 
 
 
 
 
 
51
 
52
+ // Actions
53
+ add_action('admin_menu', array( $this, 'admin_menu_link'));
54
+ add_action('admin_footer', array( $this, 'admin_scripts_footer'));
55
+ add_action('init', array( $this, 'init'));
56
+ add_action('init', array( $this, 'process_input'));
57
+ add_action('register_post', array( $this, 'send_approval_email'), 10, 3);
58
+ add_action('lostpassword_post', array( $this, 'lost_password'));
59
+ add_action( 'user_register', array( $this, 'add_user_status' ) );
60
+ //add_action('rightnow_end', array( $this, 'dashboard_stats')); // still too slow
61
 
62
+ // Filters
63
+ add_filter('registration_errors', array( $this, 'show_user_message'), 10, 1);
64
+ add_filter('login_message', array( $this, 'welcome_user'));
65
+ add_filter('screen_layout_columns', array( $this, 'screen_layout_columns'), 10, 2);
66
+ add_filter( 'authenticate', array( $this, 'validate_user' ), 30, 3);
67
+ }
68
+
69
+ public function activation_check() {
70
+ global $wp_version;
71
+
72
+ $min_wp_version = '3.1';
73
+ $exit_msg = sprintf( __('New User Approve requires WordPress %s or newer.', $this->plugin_id), $min_wp_version );
74
+ if (version_compare($wp_version, $min_wp_version, '<=')) {
75
+ exit($exit_msg);
76
  }
77
+ }
78
+
79
+ public function admin_scripts_footer() {
80
+ global $wp_db_version;
81
 
82
+ if (WP_ADMIN && isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__)) {
83
+ $page_id = ($wp_db_version >= 10851) ? '#pw_approve_tabs' : '#pw_approve_tabs > ul';
 
 
 
84
  ?>
85
  <script type="text/javascript">
86
  //<![CDATA[
90
  //]]>
91
  </script>
92
  <?php
 
93
  }
94
+ }
95
+
96
+ public function dashboard_stats() {
97
+ // Query the users table
98
+ $wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage']);
99
+ $user_status = array();
100
+
101
+ // Make the user objects
102
+ foreach ($wp_user_search->get_results() as $userid) {
103
+ $user = new WP_User($userid);
104
+ $status = get_usermeta($userid, 'pw_user_status');
105
+ if ($status == '') { // user was created in admin
106
+ update_user_meta($userid, 'pw_user_status', 'approved');
107
  $status = get_usermeta($userid, 'pw_user_status');
 
 
 
 
 
 
 
 
108
  }
109
+ if ($user_status[$status] == null) {
110
+ $user_status[$status] = 0;
111
+ }
112
+ $user_status[$status] += 1;
113
+ }
114
  ?>
115
  <div>
116
+ <p><span style="font-weight:bold;"><a href="users.php?page=<?php print basename(__FILE__) ?>"><?php _e('Users', $this->plugin_id) ?></a></span>:
117
  <?php foreach($user_status as $status =>$count) print "$count $status&nbsp;&nbsp;"; ?>
118
  </p>
119
  </div>
120
  <?php
121
+ }
122
+
123
+ /**
124
+ * @desc create the view for the admin interface
125
+ */
126
+ public function approve_admin() {
127
+ if (isset($_GET['user']) && isset($_GET['status'])) {
128
+ echo '<div id="message" class="updated fade"><p>'.__('User successfully updated.', $this->plugin_id).'</p></div>';
129
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  ?>
131
+ <div class="wrap">
132
+ <h2><?php _e('User Registration Approval', $this->plugin_id) ?></h2>
133
+
134
+ <h3><?php _e('User Management', $this->plugin_id) ?></h3>
135
+ <div id="pw_approve_tabs">
136
+ <ul>
137
+ <li><a href="#pw_pending_users"><span><?php _e('Users Pending Approval', $this->plugin_id) ?></span></a></li>
138
+ <li><a href="#pw_approved_users"><span><?php _e('Approved Users', $this->plugin_id) ?></span></a></li>
139
+ <li><a href="#pw_denied_users"><span><?php _e('Denied Users', $this->plugin_id) ?></span></a></li>
140
+ </ul>
141
+ <div id="pw_pending_users">
142
+ <?php $this->approve_table( 'pending', true, true ); ?>
143
+ </div>
144
+ <div id="pw_approved_users">
145
+ <?php $this->approve_table( 'approved', false, true ); ?>
146
+ </div>
147
+ <div id="pw_denied_users">
148
+ <?php $this->approve_table( 'denied', true, false ); ?>
 
149
  </div>
150
  </div>
151
+ </div>
152
  <?php
153
+ }
154
+
155
+ /**
156
+ * @desc the table that shows the registered users grouped by status
157
+ */
158
+ public function approve_table($status, $approve, $deny) {
159
+ global $current_user;
160
+
161
+ if ( $status != 'approved' ) {
162
+ // Query the users table
163
+ $query = array(
164
+ 'meta_key' => 'pw_user_status',
165
+ 'meta_value' => $status,
166
+ );
167
+ $wp_user_search = new WP_User_Query( $query );
168
+ } else {
169
+ $users = get_users( 'blog_id=1' );
170
+ $approved_users = array();
171
+ foreach( $users as $user ) {
172
+ $the_status = get_user_meta( $user->ID, 'pw_user_status', true );
173
+
174
+ if ( $the_status == 'approved' || empty( $the_status ) ) {
175
+ $approved_users[] = $user->ID;
176
+ }
177
+ }
178
+
179
+ // get all approved users and any usr without a status
180
+ $query = array( 'include' => $approved_users );
181
+ $wp_user_search = new WP_User_Query( $query );
182
  }
183
 
184
+ if ( isset( $wp_user_search ) && $wp_user_search->total_users > 0 ) {
 
 
 
 
185
  ?>
186
  <table class="widefat">
187
  <thead>
188
  <tr class="thead">
189
+ <th><?php _e('Username', $this->plugin_id) ?></th>
190
+ <th><?php _e('Name', $this->plugin_id) ?></th>
191
+ <th><?php _e('E-mail', $this->plugin_id) ?></th>
 
192
  <?php if ($approve && $deny) { ?>
193
+ <th colspan="2" style="text-align: center"><?php _e('Actions', $this->plugin_id) ?></th>
194
  <?php } else { ?>
195
+ <th style="text-align: center"><?php _e('Actions', $this->plugin_id) ?></th>
196
  <?php } ?>
197
  </tr>
198
  </thead>
199
  <tbody>
200
  <?php
201
+ // show each of the users
202
+ $row = 1;
203
+ foreach ($wp_user_search->get_results() as $user) {
204
+ $class = ($row % 2) ? '' : ' class="alternate"';
205
+ $avatar = get_avatar( $user->user_email, 32 );
206
+ if ($approve) {
207
+ $approve_link = get_option('siteurl').'/wp-admin/users.php?page='.basename(__FILE__).'&user='.$user->ID.'&status=approve';
208
+ $approve_link = wp_nonce_url($approve_link, 'pw_new_user_approve_action_' . get_class($this));
209
+ }
210
+ if ($deny) {
211
+ $deny_link = get_option('siteurl').'/wp-admin/users.php?page='.basename(__FILE__).'&user='.$user->ID.'&status=deny';
212
+ $deny_link = wp_nonce_url($deny_link, 'pw_new_user_approve_action_' . get_class($this));
213
+ }
214
+ if ( current_user_can( 'edit_user', $user->ID ) ) {
215
+ if ($current_user->ID == $user->ID) {
216
+ $edit_link = 'profile.php';
217
+ } else {
218
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user->ID" ) );
219
  }
220
+ $edit = '<strong><a href="' . $edit_link . '">' . $user->user_login . '</a></strong><br />';
221
+ } else {
222
+ $edit = '<strong>' . $user->user_login . '</strong>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  }
224
+
225
+ ?><tr <?php echo $class; ?>>
226
+ <td><?php echo $avatar." ".$edit; ?></td>
227
+ <td><?php echo get_user_meta( $user->ID, 'first_name', true )." ".get_user_meta( $user->ID, 'last_name', true ); ?></td>
228
+ <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>
229
+ <?php if ($approve) { ?>
230
+ <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>
231
+ <?php } ?>
232
+ <?php if ($deny) { ?>
233
+ <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>
234
+ <?php } ?>
235
+ </tr><?php
236
+ $row++;
237
+ }
238
  ?>
239
  </tbody>
240
  </table>
241
  <?php
242
+ } else {
243
+ $status_i18n = $status;
244
+ if ($status == 'approved') {
245
+ $status_i18n = __('approved', $this->plugin_id);
246
+ } else if ($status == 'denied') {
247
+ $status_i18n = __('denied', $this->plugin_id);
248
+ } else if ($status == 'pending') {
249
+ $status_i18n = __('pending', $this->plugin_id);
250
+ }
251
+
252
+ echo '<p>'.sprintf(__('There are no users with a status of %s', $this->plugin_id), $status_i18n).'</p>';
253
+ }
254
+ }
255
+
256
+ /**
257
+ * @desc send an email to the admin to request approval
258
+ */
259
+ public function send_approval_email($user_login, $user_email, $errors) {
260
+ if (!$errors->get_error_code()) {
261
+ /* check if already exists */
262
+ $user_data = get_user_by( 'login', $user_login );
263
+ if (!empty($user_data)){
264
+ $errors->add('registration_required' , __('User name already exists', $this->plugin_id), 'message');
265
  } else {
266
+ /* send email to admin for approval */
267
+ $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";
268
+ $message .= get_option('siteurl') . "\r\n\r\n";
269
+ $message .= sprintf(__('To approve or deny this user access to %s go to', $this->plugin_id), get_option('blogname')) . "\r\n\r\n";
270
+ $message .= get_option('siteurl') . "/wp-admin/users.php?page=".basename(__FILE__)."\r\n";
271
+
272
+ // send the mail
273
+ wp_mail(get_option('admin_email'), sprintf(__('[%s] User Approval', $this->plugin_id), get_option('blogname')), $message);
274
+
275
+ // create the user
276
+ $user_pass = wp_generate_password();
277
+ $user_id = wp_create_user($user_login, $user_pass, $user_email);
278
  }
279
  }
280
+ }
281
+
282
+ /**
283
+ * @desc admin approval of user
284
+ */
285
+ public function approve_user() {
286
+ global $wpdb;
287
+
288
+ $user_id = (int) $_GET['user'];
289
+ $user = new WP_User( $user_id );
290
+
291
+ // reset password to know what to send the user
292
+ $new_pass = wp_generate_password();
293
+ $data = array(
294
+ 'user_pass' => md5($new_pass),
295
+ 'user_activation_key' => '',
296
+ );
297
+ $where = array(
298
+ 'ID' => $user->ID,
299
+ );
300
+ $wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d'));
301
+
302
+ wp_cache_delete($user->ID, 'users');
303
+ wp_cache_delete($user->user_login, 'userlogins');
304
+
305
+ // send email to user telling of approval
306
+ $user_login = stripslashes($user->user_login);
307
+ $user_email = stripslashes($user->user_email);
308
+
309
+ // format the message
310
+ $message = sprintf(__('You have been approved to access %s', $this->plugin_id), get_option('blogname')) . "\r\n";
311
+ $message .= sprintf(__('Username: %s', $this->plugin_id), $user_login) . "\r\n";
312
+ $message .= sprintf(__('Password: %s', $this->plugin_id), $new_pass) . "\r\n";
313
+ $message .= get_option('siteurl') . "/wp-login.php\r\n";
314
+
315
+ // send the mail
316
+ @wp_mail($user_email, sprintf(__('[%s] Registration Approved', $this->plugin_id), get_option('blogname')), $message);
317
+
318
+ // change usermeta tag in database to approved
319
+ update_user_meta($user->ID, 'pw_user_status', 'approved');
320
+ }
321
+
322
+ /**
323
+ * @desc admin denial of user
324
+ */
325
+ public function deny_user() {
326
+ $user_id = (int) $_GET['user'];
327
+ $user = new WP_User( $user_id );
328
+
329
+ // send email to user telling of denial
330
+ $user_email = stripslashes($user->user_email);
331
+
332
+ // format the message
333
+ $message = sprintf(__('You have been denied access to %s', $this->plugin_id), get_option('blogname'));
334
+
335
+ // send the mail
336
+ @wp_mail($user_email, sprintf(__('[%s] Registration Denied', $this->plugin_id), get_option('blogname')), $message);
337
+
338
+ // change usermeta tag in database to denied
339
+ update_user_meta($user->ID, 'pw_user_status', 'denied');
340
+ }
341
+
342
+ /**
343
+ * @desc display a message to the user if they have not been approved
344
+ */
345
+ public function show_user_message($errors) {
346
+ if ( $errors->get_error_code() )
347
+ return $errors;
348
+
349
+ $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));
350
+ $message .= sprintf(__('You will receive an email with instructions on what you will need to do next. Thanks for your patience.', $this->plugin_id));
351
+
352
+ $errors->add('registration_required', $message, 'message');
353
+
354
+ if (function_exists('login_header')) {
355
+ login_header(__('Pending Approval', $this->plugin_id), '<p class="message register">' . __("Registration successful.", $this->plugin_id) . '</p>', $errors);
356
+ }
357
+
358
+ echo "<body></html>";
359
+ exit();
360
+ }
361
+
362
+ /**
363
+ * @desc accept input from admin to modify a user
364
+ */
365
+ public function process_input() {
366
+ if ((isset($_GET['page']) && $_GET['page'] == basename(__FILE__)) && isset($_GET['status'])) {
367
+ $valid_request = check_admin_referer('pw_new_user_approve_action_' . get_class($this));
368
+
369
+ if ($valid_request) {
370
+ if ($_GET['status'] == 'approve') {
371
+ $this->approve_user();
372
+ }
373
+
374
+ if ($_GET['status'] == 'deny') {
375
+ $this->deny_user();
376
  }
377
  }
378
  }
379
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
 
381
+ /**
382
+ * @desc only give a user their password if they have been approved
383
+ */
384
+ public function lost_password() {
385
+ $is_email = strpos($_POST['user_login'], '@');
386
+ if ($is_email === false) {
387
+ $username = sanitize_user($_POST['user_login']);
388
+ $user_data = get_userdatabylogin(trim($username));
389
+ } else {
390
+ $email = is_email($_POST['user_login']);
391
+ $user_data = get_user_by_email($email);
 
 
 
 
 
 
 
 
 
392
  }
393
+
394
+ if ($user_data->pw_user_status != 'approved') {
395
+ wp_redirect('wp-login.php');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  exit();
397
  }
398
+
399
+ return;
400
+ }
401
+
402
+ public function welcome_user($message) {
403
+ if (!isset($_GET['action'])) {
404
+ $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'));
405
+ $message .= '<p class="message">' . $inside . '</p>';
 
 
 
 
 
 
 
 
 
 
406
  }
407
+
408
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && !$_POST ) {
409
+ $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));
410
+ $message .= '<p class="message">' . $inside . '</p>';
411
+ }
412
+
413
+ return $message;
414
+ }
415
+
416
+ public function init() {
417
+ if ( is_admin() && isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) {
418
+ wp_enqueue_script('jquery-ui-tabs');
419
+ wp_enqueue_style('pw-admin-ui-tabs', plugins_url( 'ui.tabs.css', __FILE__ ) );
420
+ }
421
+ }
422
+
423
+ function admin_menu_link() {
424
+ $this->user_page_hook = add_submenu_page('users.php', __('Approve New Users', $this->plugin_id), __('Approve New Users', $this->plugin_id), 'edit_users', basename(__FILE__), array(&$this, 'approve_admin'));
425
+ }
426
+
427
+ public function validate_user( $empty, $username, $password ) {
428
+ if (empty( $username ) ) {
429
  return;
430
  }
431
+
432
+ $user = get_user_by( 'login', $username );
433
+ $status = get_user_meta( $user->ID, 'pw_user_status', true );
434
+
435
+ if ( empty( $status ) ) {
436
+ // the user does not have a status so let's assume the user is good to go
437
+ return $user;
 
 
 
 
 
 
438
  }
439
+
440
+ $message = false;
441
+ switch ( $status ) {
442
+ case 'pending':
443
+ $message = new WP_Error('pending_approval', __('<strong>ERROR</strong>: Your account is still pending approval.'));
444
+ break;
445
+ case 'denied':
446
+ $message = new WP_Error('denied_access', __('<strong>ERROR</strong>: Your account has been denied access to this site.'));
447
+ break;
448
+ case 'approved':
449
+ $message = $user;
450
+ break;
451
  }
 
 
452
 
453
+ return $message;
 
 
 
 
454
  }
455
+
456
+ public function add_user_status( $user_id ) {
457
+ $status = 'pending';
458
+ if ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) {
459
+ $status = 'approved';
460
+ }
461
+ update_user_meta( $user_id, 'pw_user_status', $status );
462
+ }
463
+
464
+ } // End Class
465
+ } // End if class exists statement
466
 
467
  // instantiate the class
468
  if (class_exists('pw_new_user_approve')) {
469
  $pw_new_user_approve = new pw_new_user_approve();
470
  }
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
  Contributors: picklewagon
3
- Donate link: http://www.picklewagon.com/wordpress/
4
  Tags: users, registration
5
- Requires at least: 2.6
6
- Tested up to: 3.1
7
- Stable tag: 1.2.6
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.
@@ -15,7 +15,7 @@ In a normal Wordpress blog, once a new user registers, the user is created in
15
  the database. Then an email is sent to the new user with their login
16
  credentials. Very simple. As it should be.
17
 
18
- The New User Approve plugin changes up the registration process. When a user
19
  registers for the blog, the user gets created and then an email gets sent to
20
  the administrators of the site. An administrator then is expected to either
21
  approve or deny the registration request. An email is then sent to the user
@@ -36,14 +36,30 @@ user will not be able to login to the site.
36
  The New User Approve plugin uses the functions provided by WordPress to send
37
  email. Make sure your host is setup correctly to send email if this happens.
38
 
 
 
 
 
 
 
 
 
 
39
  == Screenshots ==
40
 
41
  1. The backend to manage approving and denying users.
42
 
43
  == Changelog ==
44
 
 
 
 
 
 
 
 
45
  = 1.2.6 =
46
- * fix for 3.1 to include the deprecated code for user search
47
 
48
  = 1.2.5 =
49
  * add french translation
@@ -96,15 +112,26 @@ email. Make sure your host is setup correctly to send email if this happens.
96
  * add nonces to approve and deny actions
97
  * temporary fix for pagination bug
98
 
 
 
 
 
 
99
  == Other Notes ==
100
 
101
  = Translations =
102
  The plugin has been prepared to be translated. If you want to help to translate
103
  the plugin to your language, please have a look at the localization/new-user-approve.pot file which
104
- contains all defintions and may be used with a gettext editor like Poedit (Windows).
 
105
 
106
  * Belarusian translation by <a href="http://www.fatcow.com/">Fat Cow</a>
107
- * Danish translation by <a href="http://alt3rnet.info">Leftys</a>
108
  * French translation by <a href="http://philippe.scoffoni.net">Philippe Scoffoni</a>
109
- * Greek translation by <a href="http://wordpress.org/support/profile/2874976">GeorgWP</a>
110
  * Polish translation by <a href="http://wordpress.org/support/profile/1271256">pik256</a>
 
 
 
 
 
1
  === Plugin Name ===
2
  Contributors: picklewagon
3
+ Donate link: http://picklewagon.com/wordpress/new-user-approve/donate
4
  Tags: users, registration
5
+ Requires at least: 3.1
6
+ Tested up to: 3.3.2
7
+ Stable tag: 1.3
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.
15
  the database. Then an email is sent to the new user with their login
16
  credentials. Very simple. As it should be.
17
 
18
+ The New User Approve plugin modifies the registration process. When a user
19
  registers for the blog, the user gets created and then an email gets sent to
20
  the administrators of the site. An administrator then is expected to either
21
  approve or deny the registration request. An email is then sent to the user
36
  The New User Approve plugin uses the functions provided by WordPress to send
37
  email. Make sure your host is setup correctly to send email if this happens.
38
 
39
+ = How do customize the email address when sending notifications to users? =
40
+
41
+ This is not a function of the plugin but of WordPress. WordPress provides the
42
+ 'wp_mail_from' and 'wp_mail_from_name' filters to allow you to customize this.
43
+ There are also a number of plugins that provide a setting to change this to
44
+ your liking.
45
+ * <a href="http://wordpress.org/extend/plugins/wp-mailfrom/" target="_blank">wp mail from</a>
46
+ * <a href="http://wordpress.org/extend/plugins/mail-from/" target="_blank">Mail From</a>
47
+
48
  == Screenshots ==
49
 
50
  1. The backend to manage approving and denying users.
51
 
52
  == Changelog ==
53
 
54
+ = 1.3 =
55
+ * use the User API to retrieve a user instead of querying the db
56
+ * require at least WordPress 3.1
57
+ * add validate_user function to fix authentication problems
58
+ * add new translations
59
+ * get rid of plugin errors with WP_DEBUG set to true
60
+
61
  = 1.2.6 =
62
+ * fix to include the deprecated code for user search
63
 
64
  = 1.2.5 =
65
  * add french translation
112
  * add nonces to approve and deny actions
113
  * temporary fix for pagination bug
114
 
115
+ == Upgrade Notice ==
116
+
117
+ = 1.3 =
118
+ This version fixes some issues when authenticating users. Requires at least WordPress 3.1.
119
+
120
  == Other Notes ==
121
 
122
  = Translations =
123
  The plugin has been prepared to be translated. If you want to help to translate
124
  the plugin to your language, please have a look at the localization/new-user-approve.pot file which
125
+ contains all defintions and may be used with a gettext editor like Poedit (Windows). More
126
+ information can be found on the <a href="http://codex.wordpress.org/Translating_WordPress">Codex</a>
127
 
128
  * Belarusian translation by <a href="http://www.fatcow.com/">Fat Cow</a>
129
+ * Danish translation by <a href="http://wordpress.org/support/profile/2874976">GeorgWP</a>
130
  * French translation by <a href="http://philippe.scoffoni.net">Philippe Scoffoni</a>
131
+ * Greek translation by <a href="http://alt3rnet.info">Leftys</a>
132
  * Polish translation by <a href="http://wordpress.org/support/profile/1271256">pik256</a>
133
+ * German translation by Christoph Ploedt
134
+ * Spanish translation by <a href="http://sinetiks.com">Eduardo Aranda</a>
135
+ * Dutch translation by <a href="http://profiles.wordpress.org/users/moolie/">Ronald Moolenaar</a>
136
+ * Italian translation by <a href="http://profiles.wordpress.org/users/pierinux">Pierfrancesco Marsiaj</a>
137
+