Changeset 8645
- Timestamp:
- 07/17/2014 07:59:53 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-filters.php
r8644 r8645 27 27 add_filter( 'bp_get_the_profile_field_value', 'esc_html', 8 ); 28 28 add_filter( 'bp_get_the_profile_field_value', 'convert_smilies', 9 ); 29 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value', 1, 2 ); 30 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value_by_type', 8, 2 ); 31 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 ); 29 32 30 33 add_filter( 'bp_get_the_profile_field_edit_value', 'force_balance_tags' ); … … 47 50 48 51 add_filter( 'xprofile_get_field_data', 'stripslashes' ); 49 50 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value', 1, 2 );51 add_filter( 'bp_get_the_site_member_profile_data', 'xprofile_filter_format_field_value', 1, 2 );52 52 add_filter( 'xprofile_get_field_data', 'xprofile_filter_format_field_value_by_field_id', 5, 2 ); 53 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_format_field_value_by_type', 8, 2 );54 add_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );55 53 56 54 add_filter( 'xprofile_data_value_before_save', 'xprofile_sanitize_data_value_before_save', 1, 2 ); … … 83 81 * @return string 84 82 */ 85 function xprofile_sanitize_data_value_before_save ( $field_value, $field_id, $reserialize = true ) {83 function xprofile_sanitize_data_value_before_save( $field_value, $field_id = 0, $reserialize = true ) { 86 84 87 85 // Return if empty … … 109 107 } 110 108 111 if ( !empty( $reserialize ) ) 109 if ( !empty( $reserialize ) ) { 112 110 $filtered_field_value = serialize( $filtered_values ); 113 else111 } else { 114 112 $filtered_field_value = $filtered_values; 113 } 115 114 } 116 115 … … 128 127 */ 129 128 function xprofile_filter_format_field_value( $field_value, $field_type = '' ) { 129 130 130 // Valid field values of 0 or '0' get caught by empty(), so we have an extra check for these. See #BP5731 131 if ( ! isset( $field_value ) || empty( $field_value ) && '0' != $field_value )131 if ( ! isset( $field_value ) || empty( $field_value ) && ( '0' !== $field_value ) ) { 132 132 return false; 133 134 if ( 'datebox' != $field_type ) { 135 $field_value = str_replace(']]>', ']]>', $field_value ); 133 } 134 135 if ( 'datebox' !== $field_type ) { 136 $field_value = str_replace( ']]>', ']]>', $field_value ); 136 137 } 137 138 … … 176 177 177 178 function xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) { 178 if ( 'datebox' == $field_type ) 179 180 if ( 'datebox' === $field_type ) { 179 181 return $field_value; 180 181 if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) ) 182 } 183 184 if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) ) { 182 185 return $field_value; 186 } 183 187 184 188 $values = explode( ',', $field_value ); … … 223 227 * @return array $comments 224 228 */ 225 function xprofile_filter_comments( $comments, $post_id ) { 229 function xprofile_filter_comments( $comments, $post_id = 0 ) { 230 226 231 // Locate comment authors with WP accounts 227 232 foreach( (array) $comments as $comment ) { … … 261 266 * @since BuddyPress (1.7) 262 267 * 263 * @global BuddyPress $bp264 * @global WPDB $wpdb265 268 * @param BP_User_Query $user_query 266 269 * @param string $user_ids_sql 267 270 */ 268 function bp_xprofile_filter_user_query_populate_extras( BP_User_Query $user_query, $user_ids_sql ) { 269 global $bp, $wpdb; 271 function bp_xprofile_filter_user_query_populate_extras( BP_User_Query $user_query, $user_ids_sql = '' ) { 270 272 271 273 if ( ! bp_is_active( 'xprofile' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.