PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
← All changes | includes/users/signups.php +18 -48 trunk2.6.17 View file →
@@ -13,9 +13,9 @@
13 13 // Exit if accessed directly
14 14 defined( 'ABSPATH' ) || exit;
15 15
16 16 /**
17 - * Output the forum-role field when adding a new user.
17 + * Output the forum-role field when adding a new user
18 18 *
19 19 * @since 2.6.0 bbPress (r6674)
20 20 */
21 21 function bbp_add_user_form_role_field() {
@@ -59,13 +59,13 @@
59 59 <?php
60 60 }
61 61
62 62 /**
63 - * Maybe add forum role to signup meta array.
63 + * Maybe add forum role to signup meta array
64 64 *
65 65 * @since 2.6.0 bbPress (r6674)
66 66 *
67 - * @param array $meta The signup meta.
67 + * @param array $meta
68 68 *
69 69 * @return array
70 70 */
71 71 function bbp_user_add_role_to_signup_meta( $meta = array() ) {
@@ -95,9 +95,9 @@
95 95 return $meta;
96 96 }
97 97
98 98 /**
99 - * Add forum meta data when inviting a user to a site.
99 + * Add forum meta data when inviting a user to a site
100 100 *
101 101 * @since 2.6.0 bbPress (r6674)
102 102 *
103 103 * @param int $user_id The invited user's ID.
@@ -102,10 +102,8 @@
102 102 *
103 103 * @param int $user_id The invited user's ID.
104 104 * @param array $role The role of invited user.
105 105 * @param string $newuser_key The key of the invitation.
106 - *
107 - * @return void
108 106 */
109 107 function bbp_user_add_role_on_invite( $user_id = '', $role = '', $newuser_key = '' ) {
110 108
111 109 // Role to validate
@@ -120,13 +118,8 @@
120 118 if ( bbp_has_errors() ) {
121 119 return;
122 120 }
123 121
124 - // Bail if malformed user key
125 - if ( empty( $newuser_key ) || ! is_string( $newuser_key ) ) {
126 - return;
127 - }
128 -
129 122 // Option key
130 123 $option_key = 'new_user_' . $newuser_key;
131 124
132 125 // Get the user option
@@ -139,15 +132,13 @@
139 132 update_option( $option_key, $user_option );
140 133 }
141 134
142 135 /**
143 - * Single-site handler for adding a new user.
136 + * Single-site handler for adding a new user
144 137 *
145 138 * @since 2.6.0 bbPress (r6674)
146 139 *
147 -* @param int $user_id The user ID.
148 - *
149 - * @return void
140 + * @param int $user_id
150 141 */
151 142 function bbp_user_add_role_on_register( $user_id = '' ) {
152 143
153 144 // Role to validate
@@ -167,17 +158,13 @@
167 158 bbp_set_user_role( $user_id, $valid_role );
168 159 }
169 160
170 161 /**
171 - * Multi-site handler for adding a new user.
162 + * Multi-site handler for adding a new user
172 163 *
173 164 * @since 2.6.0 bbPress (r6674)
174 165 *
175 - * @param int $user_id User ID.
176 - * @param string $password User password.
177 - * @param array $meta Array of metadata.
178 - *
179 - * @return void
166 + * @param int $user_id User ID.
180 167 */
181 168 function bbp_user_add_role_on_activate( $user_id = 0, $password = '', $meta = array() ) {
182 169
183 170 // Role to validate
@@ -208,11 +195,10 @@
208 195 * Multisite installations.
209 196 *
210 197 * @since 2.6.5
211 198 *
212 - * @param string $to_validate A role ID to validate.
213 - *
214 - * @return string A valid role ID, or empty string on error.
199 + * @param string $to_validate A role ID to validate
200 + * @return string A valid role ID, or empty string on error
215 201 */
216 202 function bbp_validate_signup_role( $to_validate = '' ) {
217 203
218 204 // Default return value
@@ -232,27 +218,19 @@
232 218 if ( ! bbp_has_errors() ) {
233 219 $retval = $to_validate;
234 220 }
235 221
236 - /**
237 - * Filters the validated signup role.
238 - *
239 - * @since 2.6.5
240 - *
241 - * @param string $retval The valid role ID if validation passes; otherwise, an empty string.
242 - * @param string $to_validate The role ID that was validated.
243 - */
222 + // Filter & return
244 223 return (string) apply_filters( 'bbp_validate_signup_role', $retval, $to_validate );
245 224 }
246 225
247 226 /**
248 - * Validate the Forum role during the registration process.
227 + * Validate the Forum role during the registration process
249 228 *
250 229 * @since 2.6.5
251 230 *
252 - * @param string $to_validate A role ID to validate.
253 - *
254 - * @return string A valid role ID, or empty string on error.
231 + * @param string $to_validate A well-formed (string) role ID to validate
232 + * @return string A valid role ID, or empty string on error
255 233 */
256 234 function bbp_validate_registration_role( $to_validate = '' ) {
257 235
258 236 // Default return value
@@ -257,13 +235,9 @@
257 235
258 236 // Default return value
259 237 $retval = bbp_get_default_role();
260 238
261 - /**
262 - * Conditionally accept admin-area posted values for capable users. This is
263 - * to allow for Site/Network Admins to assign a default role when inviting
264 - * or creating a new User account.
265 - */
239 + // Conditionally handle posted values for capable users
266 240 if ( is_admin() && current_user_can( 'create_users' ) ) {
267 241 $retval = $to_validate;
268 242 }
269 243
@@ -271,21 +245,17 @@
271 245 return bbp_validate_signup_role( $retval );
272 246 }
273 247
274 248 /**
275 - * Validate the Forum role during multisite activation.
249 + * Validate the Forum role during activation
276 250 *
277 251 * This function exists simply for parity with registrations, and to maintain an
278 252 * intentional layer of abstraction from the more generic function it uses.
279 253 *
280 - * Note: this will not fire inside of wp-activate.php unless it is hooked in
281 - * during sunrise.php, and is considered an advanced use-case.
282 - *
283 254 * @since 2.6.5
284 255 *
285 - * @param string $to_validate A role ID to validate.
286 - *
287 - * @return string A valid role ID, or empty string on error.
256 + * @param string $to_validate A well-formed (string) role ID to validate
257 + * @return string A valid role ID, or empty string on error
288 258 */
289 259 function bbp_validate_activation_role( $to_validate = '' ) {
290 260
291 261 // Validate & return