Changeset 3462731
- Timestamp:
- 02/16/2026 05:10:53 PM (6 weeks ago)
- Location:
- personalizewp
- Files:
-
- 8 edited
- 1 copied
-
tags/3.4.2 (copied) (copied from personalizewp/trunk)
-
tags/3.4.2/README.txt (modified) (2 diffs)
-
tags/3.4.2/includes/class-db-manager.php (modified) (5 diffs)
-
tags/3.4.2/includes/integrations/woocommerce/class-woocommerce-memberships-teams.php (modified) (5 diffs)
-
tags/3.4.2/personalizewp.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/includes/class-db-manager.php (modified) (5 diffs)
-
trunk/includes/integrations/woocommerce/class-woocommerce-memberships-teams.php (modified) (5 diffs)
-
trunk/personalizewp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
personalizewp/tags/3.4.2/README.txt
r3458877 r3462731 4 4 Requires at least: 6.2.0 5 5 Tested up to: 6.9 6 Stable tag: 3.4. 16 Stable tag: 3.4.2 7 7 Requires PHP: 7.4 8 8 License: GPL v3 … … 181 181 182 182 == Changelog == 183 184 = 3.4.2 = 185 186 * Bug fix: Remove reliance on current admin user when getting all Membership Teams, causing most of the Teams to not show. 187 * Bug fix: Ensure invalid Membership Team IDs are not stored against visitors. 188 * Enhancement: Clear any invalid Membership Team IDs that might be stored against visitors. 183 189 184 190 = 3.4.1 = -
personalizewp/tags/3.4.2/includes/class-db-manager.php
r3458877 r3462731 39 39 * @var int 40 40 */ 41 const DB_VERSION = 34 1; // Increment with each change in db41 const DB_VERSION = 342; // Increment with each change in db 42 42 43 43 /** … … 140 140 } 141 141 142 if ( $current_db_version < 34 1) {143 $this->upgrade_34 1( $current_db_version );142 if ( $current_db_version < 342 ) { 143 $this->upgrade_342( $current_db_version ); 144 144 } 145 145 … … 371 371 372 372 /** 373 * Executes changes made in 3.4. 1.374 * 375 * @since 3.4. 1373 * Executes changes made in 3.4.2. 374 * 375 * @since 3.4.2 376 376 * 377 377 * @param int $db_version The old (current) database version. … … 379 379 * @return void 380 380 */ 381 private function upgrade_34 1( $db_version ) {382 global $wpdb; 383 384 if ( $db_version < 34 1) {381 private function upgrade_342( $db_version ) { 382 global $wpdb; 383 384 if ( $db_version < 342 ) { 385 385 386 386 // Check for use of Teams, no need to run if not. Cannot check for our Teams class as this upgrade runs early. … … 393 393 } 394 394 395 // 1: Get all Visitor IDs with corresponding WP User ID meta, without a teams meta field ID 395 // 0: Remove any potential invalid zero IDs on membership teams. 396 $num_deleted = $wpdb->query( 397 $wpdb->prepare( 398 'DELETE FROM %i WHERE meta_key = %s AND meta_value = 0', 399 $wpdb->prefix . 'pwp_contacts_meta', 400 'wc_memberships_team_id' 401 ) 402 ); 403 404 // 1: Get all Visitor IDs with corresponding WP User ID meta, without a teams meta field ID. 396 405 $visitor_ids = $wpdb->get_col( 397 406 $wpdb->prepare( -
personalizewp/tags/3.4.2/includes/integrations/woocommerce/class-woocommerce-memberships-teams.php
r3458877 r3462731 153 153 public function get_team_by_id( int $team_id ) { 154 154 155 if ( empty( $team_id ) || ! function_exists( 'wc_memberships_for_teams_get_team' )) {155 if ( empty( $team_id ) ) { 156 156 return null; 157 157 } … … 174 174 public function get_membership_teams(): array { 175 175 176 if ( ! function_exists( 'wc_memberships_for_teams _get_teams' ) ) {176 if ( ! function_exists( 'wc_memberships_for_teams' ) ) { 177 177 return array(); 178 178 } … … 184 184 185 185 // Start afresh. 186 $this->teams = array(); 187 $_teams = wc_memberships_for_teams_get_teams(); 188 foreach ( $_teams as $team ) { 189 $_id = $team->get_id(); 190 $this->teams[ $_id ] = array( 191 'ID' => $_id, 186 $this->teams = array(); 187 $teams_handler = wc_memberships_for_teams()->get_teams_handler_instance(); 188 $_teams_query = new \WP_Query( 189 array( 190 'post_type' => 'wc_memberships_team', 191 'status' => 'any', 192 'fields' => 'ids', 193 'posts_per_page' => -1, 194 'nopaging' => true, 195 'suppress_filters' => false, 196 ) 197 ); 198 foreach ( $_teams_query->posts as $team_id ) { 199 $team = $teams_handler->get_team( $team_id ); 200 if ( ! $team ) { 201 continue; 202 } 203 $this->teams[ $team_id ] = array( 204 'ID' => $team_id, 192 205 'team_name' => $team->get_name(), 193 206 'team_email' => '', // Not currently supported … … 820 833 * 821 834 * @param int $user_id ID of WordPress User 822 * @return int ID of Membership Team, or zeroif none found or error835 * @return int ID of Membership Team, or null if none found or error 823 836 */ 824 837 public function get_membership_team_id_by_user_id( $user_id ) { 825 838 826 839 if ( ! function_exists( 'wc_memberships_for_teams_get_teams' ) ) { 827 return 0; 828 } 840 return null; 841 } 842 843 $team_id = null; 829 844 830 845 // Note: Cannot use 'owner' within role restriction as it overrides the query, excluding the other roles. 831 846 $teams = wc_memberships_for_teams_get_teams( $user_id, array( 'role' => array( 'manager', 'member' ) ), null, true ); 832 833 $team_id = 0;834 $team = array_shift( $teams ); // There should only be 1 result.835 if ( $team instanceof Team ) {836 $team_id = $team->get_id();837 } 838 839 return (int)$team_id;847 if ( is_array( $teams ) ) { 848 $team = array_shift( $teams ); // There should only be 1 result. 849 if ( $team instanceof Team ) { 850 $team_id = (int) $team->get_id(); 851 } 852 } 853 854 return $team_id; 840 855 } 841 856 … … 861 876 862 877 $team_id = $this->get_membership_team_id_by_user_id( $user_id ); 878 if ( empty( $team_id ) ) { 879 return; 880 } 863 881 864 882 // Add/update new meta data -
personalizewp/tags/3.4.2/personalizewp.php
r3458877 r3462731 11 11 * Plugin URI: https://personalizewp.com/ 12 12 * Description: Add powerful personalization features to your WordPress site. Show different content to different visitors based on their behavior, profile, location, and more. 13 * Version: 3.4. 113 * Version: 3.4.2 14 14 * Author: Filter 15 15 * Author URI: https://filter.agency/ … … 40 40 * Current plugin version. 41 41 */ 42 define( 'PERSONALIZEWP_VERSION', '3.4. 1' );42 define( 'PERSONALIZEWP_VERSION', '3.4.2' ); 43 43 44 44 // Load autoloader. -
personalizewp/trunk/README.txt
r3458877 r3462731 4 4 Requires at least: 6.2.0 5 5 Tested up to: 6.9 6 Stable tag: 3.4. 16 Stable tag: 3.4.2 7 7 Requires PHP: 7.4 8 8 License: GPL v3 … … 181 181 182 182 == Changelog == 183 184 = 3.4.2 = 185 186 * Bug fix: Remove reliance on current admin user when getting all Membership Teams, causing most of the Teams to not show. 187 * Bug fix: Ensure invalid Membership Team IDs are not stored against visitors. 188 * Enhancement: Clear any invalid Membership Team IDs that might be stored against visitors. 183 189 184 190 = 3.4.1 = -
personalizewp/trunk/includes/class-db-manager.php
r3458877 r3462731 39 39 * @var int 40 40 */ 41 const DB_VERSION = 34 1; // Increment with each change in db41 const DB_VERSION = 342; // Increment with each change in db 42 42 43 43 /** … … 140 140 } 141 141 142 if ( $current_db_version < 34 1) {143 $this->upgrade_34 1( $current_db_version );142 if ( $current_db_version < 342 ) { 143 $this->upgrade_342( $current_db_version ); 144 144 } 145 145 … … 371 371 372 372 /** 373 * Executes changes made in 3.4. 1.374 * 375 * @since 3.4. 1373 * Executes changes made in 3.4.2. 374 * 375 * @since 3.4.2 376 376 * 377 377 * @param int $db_version The old (current) database version. … … 379 379 * @return void 380 380 */ 381 private function upgrade_34 1( $db_version ) {382 global $wpdb; 383 384 if ( $db_version < 34 1) {381 private function upgrade_342( $db_version ) { 382 global $wpdb; 383 384 if ( $db_version < 342 ) { 385 385 386 386 // Check for use of Teams, no need to run if not. Cannot check for our Teams class as this upgrade runs early. … … 393 393 } 394 394 395 // 1: Get all Visitor IDs with corresponding WP User ID meta, without a teams meta field ID 395 // 0: Remove any potential invalid zero IDs on membership teams. 396 $num_deleted = $wpdb->query( 397 $wpdb->prepare( 398 'DELETE FROM %i WHERE meta_key = %s AND meta_value = 0', 399 $wpdb->prefix . 'pwp_contacts_meta', 400 'wc_memberships_team_id' 401 ) 402 ); 403 404 // 1: Get all Visitor IDs with corresponding WP User ID meta, without a teams meta field ID. 396 405 $visitor_ids = $wpdb->get_col( 397 406 $wpdb->prepare( -
personalizewp/trunk/includes/integrations/woocommerce/class-woocommerce-memberships-teams.php
r3458877 r3462731 153 153 public function get_team_by_id( int $team_id ) { 154 154 155 if ( empty( $team_id ) || ! function_exists( 'wc_memberships_for_teams_get_team' )) {155 if ( empty( $team_id ) ) { 156 156 return null; 157 157 } … … 174 174 public function get_membership_teams(): array { 175 175 176 if ( ! function_exists( 'wc_memberships_for_teams _get_teams' ) ) {176 if ( ! function_exists( 'wc_memberships_for_teams' ) ) { 177 177 return array(); 178 178 } … … 184 184 185 185 // Start afresh. 186 $this->teams = array(); 187 $_teams = wc_memberships_for_teams_get_teams(); 188 foreach ( $_teams as $team ) { 189 $_id = $team->get_id(); 190 $this->teams[ $_id ] = array( 191 'ID' => $_id, 186 $this->teams = array(); 187 $teams_handler = wc_memberships_for_teams()->get_teams_handler_instance(); 188 $_teams_query = new \WP_Query( 189 array( 190 'post_type' => 'wc_memberships_team', 191 'status' => 'any', 192 'fields' => 'ids', 193 'posts_per_page' => -1, 194 'nopaging' => true, 195 'suppress_filters' => false, 196 ) 197 ); 198 foreach ( $_teams_query->posts as $team_id ) { 199 $team = $teams_handler->get_team( $team_id ); 200 if ( ! $team ) { 201 continue; 202 } 203 $this->teams[ $team_id ] = array( 204 'ID' => $team_id, 192 205 'team_name' => $team->get_name(), 193 206 'team_email' => '', // Not currently supported … … 820 833 * 821 834 * @param int $user_id ID of WordPress User 822 * @return int ID of Membership Team, or zeroif none found or error835 * @return int ID of Membership Team, or null if none found or error 823 836 */ 824 837 public function get_membership_team_id_by_user_id( $user_id ) { 825 838 826 839 if ( ! function_exists( 'wc_memberships_for_teams_get_teams' ) ) { 827 return 0; 828 } 840 return null; 841 } 842 843 $team_id = null; 829 844 830 845 // Note: Cannot use 'owner' within role restriction as it overrides the query, excluding the other roles. 831 846 $teams = wc_memberships_for_teams_get_teams( $user_id, array( 'role' => array( 'manager', 'member' ) ), null, true ); 832 833 $team_id = 0;834 $team = array_shift( $teams ); // There should only be 1 result.835 if ( $team instanceof Team ) {836 $team_id = $team->get_id();837 } 838 839 return (int)$team_id;847 if ( is_array( $teams ) ) { 848 $team = array_shift( $teams ); // There should only be 1 result. 849 if ( $team instanceof Team ) { 850 $team_id = (int) $team->get_id(); 851 } 852 } 853 854 return $team_id; 840 855 } 841 856 … … 861 876 862 877 $team_id = $this->get_membership_team_id_by_user_id( $user_id ); 878 if ( empty( $team_id ) ) { 879 return; 880 } 863 881 864 882 // Add/update new meta data -
personalizewp/trunk/personalizewp.php
r3458877 r3462731 11 11 * Plugin URI: https://personalizewp.com/ 12 12 * Description: Add powerful personalization features to your WordPress site. Show different content to different visitors based on their behavior, profile, location, and more. 13 * Version: 3.4. 113 * Version: 3.4.2 14 14 * Author: Filter 15 15 * Author URI: https://filter.agency/ … … 40 40 * Current plugin version. 41 41 */ 42 define( 'PERSONALIZEWP_VERSION', '3.4. 1' );42 define( 'PERSONALIZEWP_VERSION', '3.4.2' ); 43 43 44 44 // Load autoloader.
Note: See TracChangeset
for help on using the changeset viewer.