| @@ -34,8 +34,9 @@ | ||
| 34 | 34 | * @param string $option_name Name of the WP User Option. |
| 35 | 35 | * @param mixed $default_value Default value of the WP User Option. |
| 36 | 36 | * @return mixed Current value of the WP User Option, or $default_value if it does not exist. |
| 37 | 37 | */ |
| 38 | + #[\Override] | |
| 38 | 39 | protected function _get_option( string $option_name, /* string|int|float|bool|array|null */ $default_value ) /* : string|int|float|bool|array|null */ { |
| 39 | 40 | // Non-logged-in user can never have a saved option value. |
| 40 | 41 | if ( ! is_user_logged_in() ) { |
| 41 | 42 | return $default_value; |
| @@ -57,8 +58,9 @@ | ||
| 57 | 58 | * @param string $option_name Name of the WP User Option. |
| 58 | 59 | * @param string $new_value New value of the WP User Option (not slashed). |
| 59 | 60 | * @return bool True on success, false on failure. |
| 60 | 61 | */ |
| 62 | + #[\Override] | |
| 61 | 63 | protected function _update_option( string $option_name, string $new_value ): bool { |
| 62 | 64 | // Non-logged-in user can never have a saved option value to be updated. |
| 63 | 65 | if ( ! is_user_logged_in() ) { |
| 64 | 66 | return false; |
| @@ -76,8 +78,9 @@ | ||
| 76 | 78 | * |
| 77 | 79 | * @param string $option_name Name of the WP User Option. |
| 78 | 80 | * @return bool True on success, false on failure. |
| 79 | 81 | */ |
| 82 | + #[\Override] | |
| 80 | 83 | protected function _delete_option( string $option_name ): bool { |
| 81 | 84 | // Non-logged-in user can never have a saved option value to be deleted. |
| 82 | 85 | if ( ! is_user_logged_in() ) { |
| 83 | 86 | return false; |
| @@ -94,9 +97,8 @@ | ||
| 94 | 97 | public function delete_for_all_users(): void { |
| 95 | 98 | $users = get_users(); |
| 96 | 99 | foreach ( $users as $user ) { |
| 97 | 100 | delete_user_option( $user->ID, $this->option_name, false ); |
| 98 | - // @TODO: Add other user options for different actions as well. | |
| 99 | 101 | } |
| 100 | 102 | } |
| 101 | 103 | |
| 102 | 104 | } // class TablePress_WP_User_Option |