Changeset 3136208
- Timestamp:
- 08/15/2024 03:35:52 PM (16 months ago)
- Location:
- bp-xprofile-location/trunk
- Files:
-
- 4 edited
-
inc/pp-field-type-location.php (modified) (8 diffs)
-
inc/pp-location-search-support.php (modified) (2 diffs)
-
loader.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bp-xprofile-location/trunk/inc/pp-field-type-location.php
r3105747 r3136208 31 31 add_filter( 'bp_get_the_profile_field_value', array( $this, 'pp_loc_get_field_value'), 10, 3 ); 32 32 add_filter( 'xprofile_field_options_before_save', array( $this, 'pp_loc_field_options_before_save'), 20, 2 ); 33 33 34 add_filter( 'bp_signup_usermeta', array( $this, 'pp_loc_signup_usermeta'), 15, 1 ); 35 add_action( 'bp_core_signup_user', array( $this, 'pp_loc_signup_user'), 15, 5 ); 34 36 add_action( 'bp_core_activated_user', array( $this, 'pp_loc_activated_user'), 15, 3 ); 35 add_action( 'bp_core_signup_user', array( $this, 'pp_loc_signup_user'), 15, 5 ); 37 36 38 add_action( 'bp_signup_validate', array( $this, 'pp_loc_signup_validate') ); 37 39 } 40 38 41 function pp_loc_enqueue() { 39 42 … … 57 60 } 58 61 function pp_loc_scripts_styles() { 59 //wp_register_script( 'google-places-api', '//maps.googleapis.com/maps/api/js?key=' . $this->gapikey . '&libraries=places', array( 'jquery' ), false );60 62 wp_print_scripts( 'google-places-api' ); 61 63 … … 101 103 return $value; 102 104 } 105 106 103 107 function pp_loc_signup_validate() { 104 108 global $bp; … … 117 121 } 118 122 } 123 119 124 function pp_loc_signup_usermeta( $meta ) { 120 if ( isset( $meta[' profile_field_ids'] ) && !empty( $meta['profile_field_ids'] ) ) {121 $profile_field_ids = explode(',', $meta[' profile_field_ids']);125 if ( isset( $meta['signup_profile_field_ids'] ) && !empty( $meta['signup_profile_field_ids'] ) ) { 126 $profile_field_ids = explode(',', $meta['signup_profile_field_ids']); 122 127 foreach ( $profile_field_ids as $field_id ) { 123 128 $field = new BP_XProfile_Field( $field_id ); … … 134 139 return $meta; 135 140 } 141 136 142 function pp_loc_signup_user( $user_id, $user_login, $user_password, $user_email, $usermeta ) { 137 143 if ( ! is_multisite() ) { 138 144 if ( $user_id ) { 139 145 if ( bp_is_active( 'xprofile' ) ) { 140 if ( isset( $ _POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {141 $profile_field_ids = explode(',', $ _POST['signup_profile_field_ids']);146 if ( isset( $usermeta['profile_field_ids'] ) && !empty( $usermeta['profile_field_ids'] ) ) { 147 $profile_field_ids = explode(',', $usermeta['profile_field_ids']); 142 148 foreach ($profile_field_ids as $field_id) { 143 149 $field = new BP_XProfile_Field( $field_id ); 144 150 if ($field->type == 'location' ) { 145 if (isset($_POST['field_' . $field_id]) && ! empty( $_POST['field_' . $field_id] ) ) { 146 if ( ! empty( $_POST['pp_'.$field_id.'_geocode'] ) ) { 147 // the $user_id var passed by the hook is just a bool, so we need to get the int 148 global $wpdb; 149 $uid = $wpdb->get_var( "SELECT ID FROM $wpdb->users WHERE user_login = '$user_login'" ); 150 $geocode = sanitize_text_field( $_POST['pp_'.$field_id.'_geocode'] ); 151 update_user_meta( $uid, 'geocode_' . $field_id, $geocode ); 151 if (isset($usermeta['geocode_' . $field_id]) && ! empty( $usermeta['geocode_' . $field_id] ) ) { 152 $geocode = sanitize_text_field( $usermeta['geocode_' . $field_id] ); 153 update_user_meta( $user_id, 'geocode_' . $field_id, $geocode ); 152 154 } 153 }154 155 } 155 156 } … … 159 160 } 160 161 } 162 161 163 function pp_loc_activated_user( $user_id, $key, $user ) { 162 if ( is_multisite() ) {164 if ( ! is_multisite() ) { 163 165 if ( isset( $user['meta']['profile_field_ids'] ) ) { 164 166 $profile_field_ids = explode(',', $user['meta']['profile_field_ids'] ); … … 166 168 $field = new BP_XProfile_Field( $field_id ); 167 169 if ($field->type == 'location' ) { 170 168 171 if ( isset( $user['meta']['geocode_' . $field_id] ) && ! empty( $user['meta']['geocode_' . $field_id] ) ) { 169 172 update_user_meta( $user_id, 'geocode_' . $field_id, $user['meta']['geocode_' . $field_id] ); … … 174 177 } 175 178 } 179 180 181 182 176 183 function pp_loc_xprofile_data_after_save( $data ) { 177 184 -
bp-xprofile-location/trunk/inc/pp-location-search-support.php
r3012981 r3136208 23 23 function pp_loc_boss_ps_fields( $fields ) { 24 24 25 //write_log( $fields );26 25 foreach( $fields as $key => $field ) { 27 26 28 27 if ( isset( $field->type ) && $field->type == 'location' ) { 29 //write_log( $field ); 28 30 29 $field->format = 'location'; 31 30 $field->script_handle = 'google-places-api'; … … 78 77 79 78 $user_ids = pp_location_members_radial_distance( $center_lat, $center_lng, $radius, $key, $earthRadius ); 80 81 //write_log( 'xprofile');82 //write_log( $user_ids );83 84 //$user_ids = array( 1 );85 79 86 80 return $user_ids; -
bp-xprofile-location/trunk/loader.php
r3105747 r3136208 3 3 * Plugin Name: BP xProfile Location 4 4 * Description: Adds an xProfile Location field type that uses the Google Places API to complete and validate addresses 5 * Version: 4. 85 * Version: 4.9 6 6 * Author: PhiloPress 7 7 * Author URI: https://www.philopress.com/ -
bp-xprofile-location/trunk/readme.txt
r3105747 r3136208 7 7 Plugin URI: https://www.philopress.com/products/bp-xprofile-location/ 8 8 Requires at least: 4.0 9 Tested up to: 6. 510 Stable tag: 4. 89 Tested up to: 6.6 10 Stable tag: 4.9 11 11 License: GPLv2 or later 12 12 … … 90 90 == Changelog == 91 91 92 = 4.9 = 93 * fixed bug related BuddyPress registration 94 92 95 = 4.8 = 93 96 * fixed bug related to changes made in 4.7 … … 163 166 == Upgrade Notice == 164 167 168 = 4.9 = 169 * fixed bug related BuddyPress registration 170 165 171 = 4.8 = 166 172 * Fixed bug related to changes made in 4.7
Note: See TracChangeset
for help on using the changeset viewer.