Changeset 13393
- Timestamp:
- 01/06/2023 11:51:53 PM (2 years ago)
- Location:
- trunk/src/bp-xprofile
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/admin/js/admin.js
r12886 r13393 122 122 123 123 function hide( id ) { 124 if ( ! document.getElementById( id ) ) {124 if ( ! document.getElementById( id ) ) { 125 125 return false; 126 126 } -
trunk/src/bp-xprofile/bp-xprofile-admin.php
r13392 r13393 171 171 <ul id="field-group-tabs"> 172 172 173 <?php if ( ! empty( $groups ) ) : foreach ( $groups as $group ) : ?>173 <?php if ( ! empty( $groups ) ) : foreach ( $groups as $group ) : ?> 174 174 175 175 <li id="group_<?php echo esc_attr( $group->id ); ?>"> … … 180 180 ?> 181 181 182 <?php if ( ! $group->can_delete ) : ?>182 <?php if ( ! $group->can_delete ) : ?> 183 183 <?php _e( '(Primary)', 'buddypress'); ?> 184 184 <?php endif; ?> … … 197 197 </ul> 198 198 199 <?php if ( ! empty( $groups ) ) : foreach ( $groups as $group ) :199 <?php if ( ! empty( $groups ) ) : foreach ( $groups as $group ) : 200 200 201 201 // Add Field to Group URL. … … 274 274 <?php 275 275 276 if ( ! empty( $group->fields ) ) :276 if ( ! empty( $group->fields ) ) : 277 277 foreach ( $group->fields as $field ) { 278 278 … … 746 746 $field = xprofile_get_field( $field_id, null, false ); 747 747 748 if ( ! $field->delete( (bool) $delete_data ) ) {748 if ( ! $field->delete( (bool) $delete_data ) ) { 749 749 /* translators: %s: the field type */ 750 750 $message = sprintf( __( 'There was an error deleting the %s. Please try again.', 'buddypress' ), $field_type ); … … 1045 1045 ?> 1046 1046 1047 <fieldset id="<?php echo esc_attr( $fieldset_id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( ! empty( $class ) ) echo ' ' . $class; ?>">1047 <fieldset id="<?php echo esc_attr( $fieldset_id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( ! empty( $class ) ) echo ' ' . $class; ?>"> 1048 1048 <legend> 1049 1049 <span> -
trunk/src/bp-xprofile/bp-xprofile-caps.php
r12768 r13393 51 51 52 52 // Friends don't let friends edit each other's visibility. 53 if ( $profile_user_id != bp_displayed_user_id() && ! bp_current_user_can( 'bp_moderate' ) ) {53 if ( $profile_user_id != bp_displayed_user_id() && ! bp_current_user_can( 'bp_moderate' ) ) { 54 54 $caps[] = 'do_not_allow'; 55 55 break; -
trunk/src/bp-xprofile/bp-xprofile-cssjs.php
r13392 r13393 17 17 */ 18 18 function xprofile_add_admin_css() { 19 if ( ! empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {19 if ( ! empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) { 20 20 $min = bp_core_get_minified_asset_suffix(); 21 21 … … 36 36 */ 37 37 function xprofile_add_admin_js() { 38 if ( ! empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {38 if ( ! empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) { 39 39 wp_enqueue_script( 'jquery-ui-core' ); 40 40 wp_enqueue_script( 'jquery-ui-tabs' ); -
trunk/src/bp-xprofile/bp-xprofile-filters.php
r12887 r13393 248 248 } 249 249 250 if ( ! empty( $reserialize ) ) {250 if ( ! empty( $reserialize ) ) { 251 251 $filtered_field_value = serialize( $filtered_values ); 252 252 } else { -
trunk/src/bp-xprofile/bp-xprofile-functions.php
r13392 r13393 547 547 // Check against a list of registered visibility levels. 548 548 $allowed_values = bp_xprofile_get_visibility_levels(); 549 if ( ! array_key_exists( $visibility_level, $allowed_values ) ) {549 if ( ! array_key_exists( $visibility_level, $allowed_values ) ) { 550 550 return false; 551 551 } … … 554 554 $current_visibility_levels = bp_get_user_meta( $user_id, 'bp_xprofile_visibility_levels', true ); 555 555 556 if ( ! $current_visibility_levels ) {556 if ( ! $current_visibility_levels ) { 557 557 $current_visibility_levels = array(); 558 558 } … … 787 787 $search_terms_space = '%' . $search_terms_clean . ' %'; 788 788 } elseif ( $query->query_vars['search_wildcard'] === 'right' ) { 789 $search_terms_nospace = 789 $search_terms_nospace = $search_terms_clean . '%'; 790 790 $search_terms_space = '% ' . $search_terms_clean . '%'; 791 791 } else { … … 1253 1253 */ 1254 1254 function bp_xprofile_get_hidden_fields_for_user( $displayed_user_id = 0, $current_user_id = 0 ) { 1255 if ( ! $displayed_user_id ) {1255 if ( ! $displayed_user_id ) { 1256 1256 $displayed_user_id = bp_displayed_user_id(); 1257 1257 } 1258 1258 1259 if ( ! $displayed_user_id ) {1259 if ( ! $displayed_user_id ) { 1260 1260 return array(); 1261 1261 } 1262 1262 1263 if ( ! $current_user_id ) {1263 if ( ! $current_user_id ) { 1264 1264 $current_user_id = bp_loggedin_user_id(); 1265 1265 } … … 1347 1347 */ 1348 1348 function bp_xprofile_get_fields_by_visibility_levels( $user_id, $levels = array() ) { 1349 if ( ! is_array( $levels ) ) {1349 if ( ! is_array( $levels ) ) { 1350 1350 $levels = (array)$levels; 1351 1351 } -
trunk/src/bp-xprofile/bp-xprofile-template.php
r13392 r13393 424 424 $field_ids = ''; 425 425 426 if ( ! empty( $group->fields ) ) {426 if ( ! empty( $group->fields ) ) { 427 427 foreach ( (array) $group->fields as $field ) { 428 428 $field_ids .= $field->id . ','; -
trunk/src/bp-xprofile/classes/class-bp-xprofile-component.php
r13093 r13393 139 139 140 140 // Define a slug, if necessary. 141 if ( ! defined( 'BP_XPROFILE_SLUG' ) ) {141 if ( ! defined( 'BP_XPROFILE_SLUG' ) ) { 142 142 define( 'BP_XPROFILE_SLUG', 'profile' ); 143 143 } -
trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php
r13392 r13393 107 107 $html = '<option value="">' . /* translators: no option picked in select box */ esc_html__( '----', 'buddypress' ) . '</option>'; 108 108 109 if ( empty( $original_option_values ) && ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) {109 if ( empty( $original_option_values ) && ! empty( $_POST[ 'field_' . $this->field_obj->id ] ) ) { 110 110 $original_option_values = sanitize_text_field( $_POST[ 'field_' . $this->field_obj->id ] ); 111 111 } -
trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php
r13392 r13393 476 476 477 477 // Allow plugins to filter the field's child options (i.e. the items in a selectbox). 478 $post_option = ! empty( $_POST[ "{$this->type}_option" ] ) ? $_POST[ "{$this->type}_option" ] 478 $post_option = ! empty( $_POST[ "{$this->type}_option" ] ) ? $_POST[ "{$this->type}_option" ] : ''; 479 479 $post_default = ! empty( $_POST[ "isDefault_{$this->type}_option" ] ) ? $_POST[ "isDefault_{$this->type}_option" ] : ''; 480 480 … … 500 500 501 501 $counter = 1; 502 if ( ! empty( $options ) ) {502 if ( ! empty( $options ) ) { 503 503 foreach ( (array) $options as $option_key => $option_value ) { 504 504 $is_default = 0; … … 1241 1241 ), $users_url . '#tabs-' . (int) $this->group_id ); 1242 1242 1243 if ( ! empty( $_POST['saveField'] ) ) {1243 if ( ! empty( $_POST['saveField'] ) ) { 1244 1244 $this->name = $_POST['title']; 1245 1245 $this->description = $_POST['description']; … … 1270 1270 <hr class="wp-header-end"> 1271 1271 1272 <?php if ( ! empty( $message ) ) : ?>1272 <?php if ( ! empty( $message ) ) : ?> 1273 1273 1274 1274 <div id="message" class="error fade notice is-dismissible"> -
trunk/src/bp-xprofile/classes/class-bp-xprofile-profiledata.php
r13392 r13393 67 67 */ 68 68 public function __construct( $field_id = null, $user_id = null ) { 69 if ( ! empty( $field_id ) ) {69 if ( ! empty( $field_id ) ) { 70 70 $this->populate( $field_id, $user_id ); 71 71 } … … 666 666 if ( $values[ $i ]->name == $fields[ $j ] ) { 667 667 $new_values[ $fields[ $j ] ] = $values[ $i ]->value; 668 } elseif ( ! array_key_exists( $fields[ $j ], $new_values ) ) {668 } elseif ( ! array_key_exists( $fields[ $j ], $new_values ) ) { 669 669 $new_values[ $fields[ $j ] ] = NULL; 670 670 } -
trunk/src/bp-xprofile/screens/edit.php
r13392 r13393 65 65 66 66 // There are errors. 67 if ( ! empty( $errors ) ) {67 if ( ! empty( $errors ) ) { 68 68 bp_core_add_message( __( 'Your changes have not been saved. Please fill in all required fields, and save your changes again.', 'buddypress' ), 'error' ); 69 69 … … 81 81 $value = isset( $_POST[ 'field_' . $field_id ] ) ? $_POST[ 'field_' . $field_id ] : ''; 82 82 83 $visibility_level = ! empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ? $_POST[ 'field_' . $field_id . '_visibility' ] : 'public';83 $visibility_level = ! empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ? $_POST[ 'field_' . $field_id . '_visibility' ] : 'public'; 84 84 85 85 // Save the old and new values. They will be … … 149 149 150 150 // Set the feedback messages. 151 if ( ! empty( $errors ) ) {151 if ( ! empty( $errors ) ) { 152 152 bp_core_add_message( __( 'There was a problem updating some of your profile information. Please try again.', 'buddypress' ), 'error' ); 153 153 } else { -
trunk/src/bp-xprofile/screens/settings-profile.php
r13392 r13393 93 93 $visibility_level = 'public'; 94 94 95 if ( ! empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ) {95 if ( ! empty( $_POST[ 'field_' . $field_id . '_visibility' ] ) ) { 96 96 $visibility_level = $_POST[ 'field_' . $field_id . '_visibility' ]; 97 97 }
Note: See TracChangeset
for help on using the changeset viewer.