Plugin Directory

Changeset 3136208


Ignore:
Timestamp:
08/15/2024 03:35:52 PM (16 months ago)
Author:
shanebp
Message:

commit 4.9

Location:
bp-xprofile-location/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bp-xprofile-location/trunk/inc/pp-field-type-location.php

    r3105747 r3136208  
    3131            add_filter( 'bp_get_the_profile_field_value',       array( $this, 'pp_loc_get_field_value'), 10, 3 );
    3232            add_filter( 'xprofile_field_options_before_save',   array( $this, 'pp_loc_field_options_before_save'), 20, 2 );
     33
    3334            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 );   
    3436            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
    3638            add_action( 'bp_signup_validate',                   array( $this, 'pp_loc_signup_validate') );
    3739        }
     40       
    3841        function pp_loc_enqueue() {
    3942           
     
    5760        }
    5861        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 );
    6062            wp_print_scripts( 'google-places-api' );
    6163
     
    101103            return $value;
    102104        }
     105
     106
    103107        function pp_loc_signup_validate() {
    104108            global $bp;
     
    117121            }
    118122        }
     123
    119124        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']);
    122127                foreach ( $profile_field_ids as $field_id ) {
    123128                    $field = new BP_XProfile_Field( $field_id );
     
    134139            return $meta;
    135140        }
     141       
    136142        function pp_loc_signup_user( $user_id, $user_login, $user_password, $user_email, $usermeta ) {
    137143            if ( ! is_multisite() ) {
    138144                if ( $user_id ) {
    139145                    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']);
    142148                            foreach ($profile_field_ids as $field_id) {
    143149                                $field = new BP_XProfile_Field( $field_id );
    144150                                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 );
    152154                                        }
    153                                     }
    154155                                }
    155156                            }
     
    159160            }
    160161        }
     162
    161163        function pp_loc_activated_user( $user_id, $key, $user ) {
    162             if ( is_multisite() ) {
     164            if ( ! is_multisite() ) {
    163165                if ( isset( $user['meta']['profile_field_ids'] ) ) {
    164166                    $profile_field_ids = explode(',', $user['meta']['profile_field_ids'] );
     
    166168                        $field = new BP_XProfile_Field( $field_id );
    167169                        if ($field->type == 'location' ) {
     170                           
    168171                            if ( isset( $user['meta']['geocode_' . $field_id] ) && ! empty( $user['meta']['geocode_' . $field_id] ) ) {
    169172                                update_user_meta( $user_id, 'geocode_' . $field_id, $user['meta']['geocode_' . $field_id] );
     
    174177            }
    175178        }
     179       
     180
     181       
     182       
    176183        function pp_loc_xprofile_data_after_save( $data ) {
    177184
  • bp-xprofile-location/trunk/inc/pp-location-search-support.php

    r3012981 r3136208  
    2323    function pp_loc_boss_ps_fields( $fields ) {
    2424
    25         //write_log( $fields );
    2625        foreach( $fields as $key => $field ) {
    2726
    2827            if ( isset( $field->type )  && $field->type == 'location' ) {
    29 //write_log( $field );
     28
    3029                $field->format = 'location';
    3130                $field->script_handle = 'google-places-api';
     
    7877
    7978    $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 );
    8579
    8680    return $user_ids;
  • bp-xprofile-location/trunk/loader.php

    r3105747 r3136208  
    33 * Plugin Name: BP xProfile Location
    44 * Description: Adds an xProfile Location field type that uses the Google Places API to complete and validate addresses
    5  * Version: 4.8
     5 * Version: 4.9
    66 * Author: PhiloPress
    77 * Author URI: https://www.philopress.com/
  • bp-xprofile-location/trunk/readme.txt

    r3105747 r3136208  
    77Plugin URI: https://www.philopress.com/products/bp-xprofile-location/
    88Requires at least: 4.0
    9 Tested up to: 6.5
    10 Stable tag: 4.8
     9Tested up to: 6.6
     10Stable tag: 4.9
    1111License: GPLv2 or later
    1212
     
    9090== Changelog ==
    9191
     92= 4.9 =
     93* fixed bug related BuddyPress registration
     94
    9295= 4.8 =
    9396* fixed bug related to changes made in 4.7
     
    163166== Upgrade Notice ==
    164167
     168= 4.9 =
     169* fixed bug related BuddyPress registration
     170
    165171= 4.8 =
    166172* Fixed bug related to changes made in 4.7
Note: See TracChangeset for help on using the changeset viewer.