File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Update class for version 1.10.0.
4+ *
5+ * @package Progress_Planner
6+ */
7+
8+ namespace Progress_Planner \Update ;
9+
10+ /**
11+ * Update class for version 1.10.0.
12+ *
13+ * @package Progress_Planner
14+ */
15+ class Update_1100 {
16+
17+ const VERSION = '1.10.0 ' ;
18+
19+ /**
20+ * Run the update.
21+ *
22+ * @return void
23+ */
24+ public function run () {
25+ // Delete the prpl_redirect_on_login user meta for all users.
26+ // The settings page has been removed, so users can no longer change this setting.
27+ $ this ->delete_redirect_on_login_user_meta ();
28+ }
29+
30+ /**
31+ * Delete the prpl_redirect_on_login user meta for all users.
32+ *
33+ * The settings page that allowed users to set their login destination
34+ * has been removed. This migration deletes the user meta to prevent
35+ * users from being redirected to Progress Planner after login.
36+ *
37+ * @return void
38+ */
39+ private function delete_redirect_on_login_user_meta () {
40+ global $ wpdb ;
41+
42+ // Delete the user meta for all users directly from the database.
43+ // This is more efficient than looping through all users.
44+ $ wpdb ->delete ( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
45+ $ wpdb ->usermeta , // @phpstan-ignore-line property.nonObject
46+ [ 'meta_key ' => 'prpl_redirect_on_login ' ], // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
47+ [ '%s ' ]
48+ );
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments