| @@ -12,11 +12,8 @@ | ||
| 12 | 12 | use Authorizer\Helper; |
| 13 | 13 | use Authorizer\Options; |
| 14 | 14 | use Authorizer\Authorization; |
| 15 | 15 | |
| 16 | -// Prevent direct access. | |
| 17 | -defined( 'ABSPATH' ) || exit; | |
| 18 | - | |
| 19 | 16 | /** |
| 20 | 17 | * Contains functions for interfacing with WordPress users and syncing between |
| 21 | 18 | * them and users in the Authorizer lists. |
| 22 | 19 | */ |
| @@ -67,10 +64,10 @@ | ||
| 67 | 64 | $updated = true; |
| 68 | 65 | } |
| 69 | 66 | } |
| 70 | 67 | if ( $updated ) { |
| 71 | - update_option( 'auth_settings_access_users_pending', $auth_settings_access_users_pending, false ); | |
| 72 | - update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved, false ); | |
| 68 | + update_option( 'auth_settings_access_users_pending', $auth_settings_access_users_pending ); | |
| 69 | + update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved ); | |
| 73 | 70 | } |
| 74 | 71 | } |
| 75 | 72 | |
| 76 | 73 | |
| @@ -158,42 +155,16 @@ | ||
| 158 | 155 | $recently_sent_emails[] = array( |
| 159 | 156 | 'email' => $email, |
| 160 | 157 | 'time' => time(), |
| 161 | 158 | ); |
| 162 | - update_option( 'auth_settings_recently_sent_emails', $recently_sent_emails, false ); | |
| 159 | + update_option( 'auth_settings_recently_sent_emails', $recently_sent_emails ); | |
| 163 | 160 | |
| 164 | 161 | // Get welcome email subject and body text. |
| 165 | 162 | $subject = $options->get( 'access_email_approved_users_subject' ); |
| 166 | 163 | $body = apply_filters( 'the_content', $options->get( 'access_email_approved_users_body' ) ); |
| 167 | 164 | |
| 168 | - // Allow overriding the email subject via filter or constant. | |
| 169 | - if ( defined( 'AUTHORIZER_EMAIL_APPROVED_USERS_SUBJECT' ) ) { | |
| 170 | - $subject = \AUTHORIZER_EMAIL_APPROVED_USERS_SUBJECT; | |
| 171 | - } | |
| 172 | - /** | |
| 173 | - * Filters the email subject sent to new users when approving them. | |
| 174 | - * | |
| 175 | - * @since 3.11.0 | |
| 176 | - * | |
| 177 | - * @param string $subject The email subject. | |
| 178 | - */ | |
| 179 | - $subject = apply_filters( 'authorizer_email_approved_users_subject', $subject ); | |
| 180 | - | |
| 181 | - // Allow overriding the email body via filter or constant. | |
| 182 | - if ( defined( 'AUTHORIZER_EMAIL_APPROVED_USERS_BODY' ) ) { | |
| 183 | - $body = \AUTHORIZER_EMAIL_APPROVED_USERS_BODY; | |
| 184 | - } | |
| 185 | - /** | |
| 186 | - * Filters the email body sent to new users when approving them. | |
| 187 | - * | |
| 188 | - * @since 3.11.0 | |
| 189 | - * | |
| 190 | - * @param string $body The email body. | |
| 191 | - */ | |
| 192 | - $body = apply_filters( 'authorizer_email_approved_users_body', $body ); | |
| 193 | - | |
| 194 | 165 | // Fail if the subject/body options don't exist or are empty. |
| 195 | - if ( empty( $subject ) || empty( $body ) ) { | |
| 166 | + if ( is_null( $subject ) || is_null( $body ) || strlen( $subject ) === 0 || strlen( $body ) === 0 ) { | |
| 196 | 167 | return false; |
| 197 | 168 | } |
| 198 | 169 | |
| 199 | 170 | // Replace approved shortcode patterns in subject and body. |
| @@ -265,9 +236,9 @@ | ||
| 265 | 236 | } |
| 266 | 237 | } |
| 267 | 238 | } |
| 268 | 239 | if ( $changed ) { |
| 269 | - update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved, false ); | |
| 240 | + update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved ); | |
| 270 | 241 | } |
| 271 | 242 | } |
| 272 | 243 | } |
| 273 | 244 | |
| @@ -354,9 +325,9 @@ | ||
| 354 | 325 | if ( 0 === strcasecmp( $check_user['email'], $userdata['user_email'] ) ) { |
| 355 | 326 | unset( $auth_settings_access_users_approved[ $key ] ); |
| 356 | 327 | } |
| 357 | 328 | } |
| 358 | - update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved, false ); | |
| 329 | + update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved ); | |
| 359 | 330 | } |
| 360 | 331 | |
| 361 | 332 | // We're hooking into this filter merely for its location in the codebase, |
| 362 | 333 | // so make sure to return the filter value unmodified. |
| @@ -388,9 +359,9 @@ | ||
| 388 | 359 | unset( $user_list[ $key ] ); |
| 389 | 360 | } |
| 390 | 361 | } |
| 391 | 362 | if ( $list_changed ) { |
| 392 | - update_option( 'auth_settings_' . $list_name, $user_list, false ); | |
| 363 | + update_option( 'auth_settings_' . $list_name, $user_list ); | |
| 393 | 364 | } |
| 394 | 365 | } |
| 395 | 366 | } |
| 396 | 367 | |
| @@ -491,9 +462,9 @@ | ||
| 491 | 462 | 'date_added' => wp_date( 'M Y', strtotime( $user->user_registered ) ), |
| 492 | 463 | 'local_user' => true, |
| 493 | 464 | ); |
| 494 | 465 | array_push( $auth_settings_access_users_approved, $approved_user ); |
| 495 | - update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved, false ); | |
| 466 | + update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved ); | |
| 496 | 467 | } |
| 497 | 468 | |
| 498 | 469 | // Restore original blog. |
| 499 | 470 | restore_current_blog(); |
| @@ -636,10 +607,10 @@ | ||
| 636 | 607 | $updated = true; |
| 637 | 608 | } |
| 638 | 609 | |
| 639 | 610 | if ( $updated ) { |
| 640 | - update_option( 'auth_settings_access_users_pending', $auth_settings_access_users_pending, false ); | |
| 641 | - update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved, false ); | |
| 611 | + update_option( 'auth_settings_access_users_pending', $auth_settings_access_users_pending ); | |
| 612 | + update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved ); | |
| 642 | 613 | } |
| 643 | 614 | } |
| 644 | 615 | |
| 645 | 616 | |