Changeset 12886
- Timestamp:
- 04/16/2021 05:32:04 AM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
-
bp-core/admin/bp-core-admin-functions.php (modified) (1 diff)
-
bp-core/admin/bp-core-admin-schema.php (modified) (1 diff)
-
bp-core/bp-core-update.php (modified) (2 diffs)
-
bp-xprofile/admin/css/admin-rtl.css (modified) (1 diff)
-
bp-xprofile/admin/css/admin.css (modified) (1 diff)
-
bp-xprofile/admin/js/admin.js (modified) (5 diffs)
-
bp-xprofile/bp-xprofile-admin.php (modified) (9 diffs)
-
bp-xprofile/bp-xprofile-cache.php (modified) (1 diff)
-
bp-xprofile/bp-xprofile-cssjs.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-functions.php
r12780 r12886 587 587 588 588 case 'bp-profile-overview': 589 $retval = __( 'Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.', 'buddypress' ) . '<br /><br />' . __( 'Note: Any fields in the first group will appear on the signup page.', 'buddypress' );589 $retval = __( 'Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.', 'buddypress' ) . '<br /><br />' . __( 'Note: Drag fields from other groups and drop them on the "Signup Fields" tab to include them into your registration form.', 'buddypress' ); 590 590 break; 591 591 -
trunk/src/bp-core/admin/bp-core-admin-schema.php
r12617 r12886 390 390 if ( ! $wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_meta WHERE id = 1" ) ) { 391 391 $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_meta ( object_id, object_type, meta_key, meta_value ) VALUES ( 1, 'field', 'allow_custom_visibility', 'disabled' );"; 392 $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_meta ( object_id, object_type, meta_key, meta_value ) VALUES ( 1, 'field', 'signup_position', 1 );"; 392 393 } 393 394 } -
trunk/src/bp-core/bp-core-update.php
r12851 r12886 599 599 * 600 600 * - Edit the `new_avatar` activity type's component to `members`. 601 * - Upgrade Primary xProfile Group's fields to signup fields. 601 602 * 602 603 * @since 8.0.0 … … 622 623 ) 623 624 ); 625 626 if ( bp_get_signup_allowed() ) { 627 // Get the Primary Group's fields. 628 $signup_fields = $wpdb->get_col( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE group_id = 1 ORDER BY field_order ASC" ); 629 630 // Migrate potential signup fields. 631 if ( $signup_fields ) { 632 $signup_position = 0; 633 foreach ( $signup_fields as $signup_field_id ) { 634 $signup_position += 1; 635 636 $wpdb->insert( 637 $bp_prefix . 'bp_xprofile_meta', 638 array( 639 'object_id' => $signup_field_id, 640 'object_type' => 'field', 641 'meta_key' => 'signup_position', 642 'meta_value' => $signup_position, 643 ), 644 array( 645 '%d', 646 '%s', 647 '%s', 648 '%d', 649 ) 650 ); 651 } 652 } 653 } 624 654 } 625 655 -
trunk/src/bp-xprofile/admin/css/admin-rtl.css
r12660 r12886 61 61 border-bottom: 1px solid transparent; 62 62 color: #000; 63 } 64 65 li#signup-group a:focus { 66 box-shadow: none; 63 67 } 64 68 -
trunk/src/bp-xprofile/admin/css/admin.css
r12660 r12886 61 61 border-bottom: 1px solid transparent; 62 62 color: #000; 63 } 64 65 li#signup-group a:focus { 66 box-shadow: none; 63 67 } 64 68 -
trunk/src/bp-xprofile/admin/js/admin.js
r12868 r12886 97 97 98 98 // Show/hides metaboxes according to selected field type supports. 99 jQuery( '#field-type-visibiliy-metabox, #field-type-required-metabox, #field-type-autolink-metabox, #field-type-member-types ' ).show();99 jQuery( '#field-type-visibiliy-metabox, #field-type-required-metabox, #field-type-autolink-metabox, #field-type-member-types, #field-signup-position-metabox' ).show(); 100 100 if ( -1 !== XProfileAdmin.hide_required_metabox.indexOf( forWhat ) ) { 101 101 jQuery( '#field-type-required-metabox' ).hide(); 102 } 103 104 if ( -1 !== XProfileAdmin.hide_signup_position_metabox.indexOf( forWhat ) ) { 105 jQuery( '#field-signup-position-metabox' ).hide(); 102 106 } 103 107 … … 208 212 209 213 jQuery( function() { 214 var isMovingToSignups = false; 210 215 211 216 // Set focus in Field Title, if we're on the right page. … … 249 254 axis: 'x', 250 255 opacity: 1, 251 items: 'li ',256 items: 'li:not(.not-sortable)', 252 257 tolerance: 'intersect', 253 258 … … 271 276 272 277 update: function() { 278 if ( isMovingToSignups ) { 279 return false; 280 } 281 273 282 jQuery.post( ajaxurl, { 274 283 action: 'xprofile_reorder_fields', … … 349 358 drop: function( ev, ui ) { 350 359 var $item = jQuery(this), // The tab 351 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); // The tab body 360 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ), // The tab body 361 dropInGroup = function( fieldId ) { 362 var fieldOrder, postData = { 363 action: 'xprofile_reorder_fields', 364 'cookie': encodeURIComponent(document.cookie), 365 '_wpnonce_reorder_fields': jQuery( 'input#_wpnonce_reorder_fields' ).val() 366 }; 367 368 // Select new tab as current. 369 $tabs.tabs( 'option', 'active', $tab_items.index( $item ) ); 370 371 // Refresh $list variable. 372 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 373 jQuery($list).find( 'p.nofields' ).hide( 'slow' ); 374 375 jQuery.extend( postData, { 376 'field_group_id': jQuery( $list ).attr( 'id' ), 377 'group_tab': jQuery( $item ).prop( 'id' ) 378 } ); 379 380 // Set serialized data 381 fieldOrder = jQuery( $list ).sortable( 'serialize' ); 382 383 if ( fieldId ) { 384 var serializedField = fieldId.replace( 'draggable_field_', 'draggable_signup_field[]=' ); 385 if ( fieldOrder ) { 386 fieldOrder += '&' + serializedField; 387 } else { 388 fieldOrder = serializedField; 389 } 390 391 jQuery.extend( postData, { 392 'new_signup_field_id': serializedField 393 } ); 394 } else { 395 // Show new placement. 396 jQuery( this ).appendTo( $list ).show( 'slow' ).animate( { opacity: '1' }, 500 ); 397 398 // Refresh $list variable. 399 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 400 401 // Reset serialized data. 402 fieldOrder = jQuery( $list ).sortable( 'serialize' ); 403 404 jQuery.extend( postData, { 405 'field_group_id': jQuery( $list ).attr( 'id' ) 406 } ); 407 } 408 409 jQuery.extend( postData, { 410 'field_order': fieldOrder 411 } ); 412 413 // Ajax update field locations and orders. 414 jQuery.post( ajaxurl, postData, function( response ) { 415 if ( response.data && response.data.signup_field ) { 416 jQuery( $list ).append( response.data.signup_field ); 417 418 if ( response.data.field_id ) { 419 jQuery( '#draggable_field_' + response.data.field_id + ' legend' ).append( 420 jQuery( '<span></span>' ).addClass( 'bp-signup-field-label' ).html( XProfileAdmin.signup_info ) 421 ); 422 } 423 } 424 }, 'json' ).always( function() { 425 isMovingToSignups = false; 426 } ); 427 }; 352 428 353 429 // Remove helper class. 354 430 jQuery($item).removeClass( 'drop-candidate' ); 355 431 356 // Hide field, change selected tab, and show new placement. 357 ui.draggable.hide( 'slow', function() { 358 359 // Select new tab as current. 360 $tabs.tabs( 'option', 'active', $tab_items.index( $item ) ); 361 362 // Show new placement. 363 jQuery(this).appendTo($list).show( 'slow' ).animate( {opacity: '1'}, 500 ); 364 365 // Refresh $list variable. 366 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 367 jQuery($list).find( 'p.nofields' ).hide( 'slow' ); 368 369 // Ajax update field locations and orders. 370 jQuery.post( ajaxurl, { 371 action: 'xprofile_reorder_fields', 372 'cookie': encodeURIComponent(document.cookie), 373 '_wpnonce_reorder_fields': jQuery( 'input#_wpnonce_reorder_fields' ).val(), 374 'field_order': jQuery( $list ).sortable( 'serialize' ), 375 'field_group_id': jQuery( $list ).attr( 'id' ) 376 }, 377 function() {} ); 378 }); 432 if ( 'signup-group' === jQuery( $item ).prop( 'id' ) ) { 433 // Simply add the field to signup ones. 434 dropInGroup( ui.draggable.prop( 'id' ) ); 435 436 } else if ( ! ui.draggable.prop( 'id' ).match( /draggable_signup_field_([0-9]+)/ ) ) { 437 // Hide field, change selected tab, and show new placement. 438 ui.draggable.hide( 'slow', dropInGroup ); 439 } 379 440 }, 380 441 over: function() { 442 isMovingToSignups = true; 381 443 jQuery(this).addClass( 'drop-candidate' ); 382 444 }, 383 445 out: function() { 384 446 jQuery(this).removeClass( 'drop-candidate' ); 447 isMovingToSignups = false; 385 448 } 386 449 }); 387 450 } 451 452 jQuery( '#signup-fields' ).on( 'click', '.removal', function( e ) { 453 e.preventDefault(); 454 455 var fieldId = jQuery( e.target ).attr( 'href' ).replace( '#remove_field-', '' ), 456 container = jQuery( e.target ).closest( '#draggable_signup_field_' + fieldId ); 457 458 if ( ! fieldId ) { 459 return false; 460 } 461 462 // Ajax update field locations and orders. 463 jQuery.post( ajaxurl, { 464 action: 'xprofile_remove_signup_field', 465 'cookie': encodeURIComponent(document.cookie), 466 '_wpnonce_reorder_fields': jQuery( 'input#_wpnonce_reorder_fields' ).val(), 467 'signup_field_id': fieldId 468 }, function( response ) { 469 if ( response.success ) { 470 jQuery( container ).remove(); 471 jQuery( '#draggable_field_' + fieldId + ' .bp-signup-field-label' ).remove(); 472 } 473 }, 'json' ); 474 } ); 388 475 }); -
trunk/src/bp-xprofile/bp-xprofile-admin.php
r12881 r12886 189 189 <?php endforeach; endif; ?> 190 190 191 <?php if ( bp_get_signup_allowed() ) : ?> 192 <li id="signup-group" class="not-sortable last"> 193 <a href="#tabs-signup-group" class="ui-tab"> 194 <?php esc_html_e( 'Signup Fields', 'buddypress' ); ?> 195 </a> 196 </li> 197 <?php endif; ?> 198 191 199 </ul> 192 200 … … 295 303 </fieldset> 296 304 297 <?php if ( empty( $group->can_delete ) ) : ?>298 299 <p><?php esc_html_e( '* Fields in this group appear on the signup page.', 'buddypress' ); ?></p>300 301 <?php endif; ?>302 303 305 </div> 304 306 … … 310 312 <?php endif; ?> 311 313 314 <?php 315 // List fields to use into the signup form. 316 if ( bp_get_signup_allowed() ) { 317 $signup_groups = bp_xprofile_get_groups( 318 array( 319 'fetch_fields' => true, 320 'signup_fields_only' => true, 321 ) 322 ); 323 $has_signup_fields = false; 324 $signup_fields = array(); 325 $signup_fields_order = bp_xprofile_get_signup_field_ids(); 326 ?> 327 <div id="tabs-signup-group"" class="tab-wrapper"> 328 <div class="tab-toolbar"> 329 <p class="description"><?php esc_html_e( 'Drag fields from other groups and drop them on the above tab to include them into your registration form.', 'buddypress' ); ?></a> 330 </div> 331 <fieldset id="signup-fields" class="connectedSortable field-group" aria-live="polite" aria-atomic="true" aria-relevant="all"> 332 <legend class="screen-reader-text"> 333 <?php esc_html_e( 'Fields to use into the registration form', 'buddypress' );?> 334 </legend> 335 336 <?php 337 if ( ! empty( $signup_groups ) ) { 338 foreach ( $signup_groups as $signup_group ) { 339 if ( ! empty( $signup_group->fields ) ) { 340 $has_signup_fields = true; 341 342 foreach ( $signup_group->fields as $signup_field ) { 343 // Load the field. 344 $_signup_field = xprofile_get_field( $signup_field, null, false ); 345 346 /** 347 * This function handles the WYSIWYG profile field 348 * display for the xprofile admin setup screen. 349 */ 350 $signup_fields[ $_signup_field->id ] = bp_xprofile_admin_get_signup_field( $_signup_field, $signup_group, '' ); 351 } 352 } 353 } 354 355 // Output signup fields according to their signup position. 356 foreach ( $signup_fields_order as $ordered_signup_field_id ) { 357 if ( ! isset( $signup_fields[ $ordered_signup_field_id ] ) ) { 358 continue; 359 } 360 361 echo $signup_fields[ $ordered_signup_field_id ]; 362 } 363 } 364 365 if ( ! $has_signup_fields ) { 366 ?> 367 <p class="nodrag nofields"><?php esc_html_e( 'There are no registration fields set. The registration form uses the primary group by default.', 'buddypress' ); ?></p> 368 <?php 369 } 370 ?> 371 </fieldset> 372 373 <p><?php esc_html_e( '* Fields in this group appear on the registration page.', 'buddypress' ); ?></p> 374 </div> 375 <?php 376 } 377 ?> 312 378 </div> 313 379 </form> 314 380 </div> 315 316 381 <?php 317 382 } … … 581 646 582 647 // Validate signup. 583 if ( ! empty( $_POST['signup-position'] ) ) { 584 bp_xprofile_update_field_meta( $field_id, 'signup_position', (int) $_POST['signup-position'] ); 585 } else { 586 bp_xprofile_delete_meta( $field_id, 'field', 'signup_position' ); 648 if ( $field->field_type_supports( 'signup_position' ) ) { 649 if ( ! empty( $_POST['signup-position'] ) ) { 650 bp_xprofile_update_field_meta( $field_id, 'signup_position', (int) $_POST['signup-position'] ); 651 } else { 652 bp_xprofile_delete_meta( $field_id, 'field', 'signup_position' ); 653 } 587 654 } 588 655 … … 736 803 * 737 804 * @since 1.0.0 805 * @since 8.0.0 Returns a JSON object. 738 806 */ 739 807 function xprofile_ajax_reorder_fields() { 740 741 808 // Check the nonce. 742 809 check_admin_referer( 'bp_reorder_fields', '_wpnonce_reorder_fields' ); 743 810 744 811 if ( empty( $_POST['field_order'] ) ) { 745 return false; 746 } 747 748 parse_str( $_POST['field_order'], $order ); 812 return wp_send_json_error(); 813 } 749 814 750 815 $field_group_id = $_POST['field_group_id']; 751 752 foreach ( (array) $order['draggable_field'] as $position => $field_id ) { 753 xprofile_update_field_position( (int) $field_id, (int) $position, (int) $field_group_id ); 816 $group_tab = ''; 817 818 if ( isset( $_POST['group_tab'] ) && $_POST['group_tab'] ) { 819 $group_tab = wp_unslash( $_POST['group_tab'] ); 820 } 821 822 if ( 'signup-fields' === $field_group_id ) { 823 parse_str( $_POST['field_order'], $order ); 824 $fields = (array) $order['draggable_signup_field']; 825 $fields = array_map( 'intval', $fields ); 826 827 if ( isset( $_POST['new_signup_field_id'] ) && $_POST['new_signup_field_id'] ) { 828 parse_str( $_POST['new_signup_field_id'], $signup_field ); 829 $signup_fields = (array) $signup_field['draggable_signup_field']; 830 } 831 832 // Adding a new field to the registration form. 833 if ( 'signup-group' === $group_tab ) { 834 $field_id = (int) reset( $signup_fields ); 835 836 // Load the field. 837 $field = xprofile_get_field( $field_id, null, false ); 838 839 if ( $field instanceof BP_XProfile_Field ) { 840 // The field doesn't support the feature, stop right away! 841 if ( ! $field->field_type_supports( 'signup_position' ) ) { 842 wp_send_json_error( 843 array( 844 'message' => __( 'This field cannot be inserted into the registration form.', 'buddypress' ), 845 ) 846 ); 847 } 848 849 $signup_position = bp_xprofile_get_meta( $field->id, 'field', 'signup_position' ); 850 851 if ( ! $signup_position ) { 852 $position = array_search( $field->id, $fields, true ); 853 if ( false !== $position ) { 854 $position += 1; 855 } else { 856 $position = 1; 857 } 858 859 // Set the signup position. 860 bp_xprofile_update_field_meta( $field->id, 'signup_position', $position ); 861 862 // Get the real Group object. 863 $group = xprofile_get_field_group( $field->id ); 864 865 // Gets the HTML Output of the signup field. 866 $signup_field = bp_xprofile_admin_get_signup_field( $field, $group ); 867 868 /** 869 * Fires once a signup field has been inserted. 870 * 871 * @since 8.0.0 872 */ 873 do_action( 'bp_xprofile_inserted_signup_field' ); 874 875 // Send the signup field to output. 876 wp_send_json_success( 877 array( 878 'signup_field' => $signup_field, 879 'field_id' => $field->id, 880 ) 881 ); 882 } else { 883 wp_send_json_error( 884 array( 885 'message' => __( 'This field has been already added to the registration form.', 'buddypress' ), 886 ) 887 ); 888 } 889 890 } else { 891 wp_send_json_error(); 892 } 893 } else { 894 // it's a sort operation. 895 foreach ( $fields as $position => $field_id ) { 896 bp_xprofile_update_field_meta( (int) $field_id, 'signup_position', (int) $position + 1 ); 897 } 898 899 /** 900 * Fires once the signup fields have been reordered. 901 * 902 * @since 8.0.0 903 */ 904 do_action( 'bp_xprofile_reordered_signup_fields' ); 905 906 wp_send_json_success(); 907 } 908 } else { 909 /** 910 * @todo there's something going wrong here. 911 * moving a field to another tab when there's only the fullname field fails. 912 */ 913 parse_str( $_POST['field_order'], $order ); 914 $fields = (array) $order['draggable_field']; 915 916 foreach ( $fields as $position => $field_id ) { 917 xprofile_update_field_position( (int) $field_id, (int) $position, (int) $field_group_id ); 918 } 919 920 wp_send_json_success(); 754 921 } 755 922 } 756 923 add_action( 'wp_ajax_xprofile_reorder_fields', 'xprofile_ajax_reorder_fields' ); 924 925 /** 926 * Removes a field from signup fields. 927 * 928 * @since 8.0.0 929 */ 930 function bp_xprofile_ajax_remove_signup_field() { 931 // Check the nonce. 932 check_admin_referer( 'bp_reorder_fields', '_wpnonce_reorder_fields' ); 933 934 if ( ! isset( $_POST['signup_field_id'] ) || ! $_POST['signup_field_id'] ) { 935 return wp_send_json_error(); 936 } 937 938 $signup_field_id = (int) wp_unslash( $_POST['signup_field_id'] ); 939 940 // Validate the field ID. 941 $signup_position = bp_xprofile_get_meta( $signup_field_id, 'field', 'signup_position' ); 942 943 if ( ! $signup_position ) { 944 wp_send_json_error(); 945 } 946 947 bp_xprofile_delete_meta( $signup_field_id, 'field', 'signup_position' ); 948 949 /** 950 * Fires when a signup field is removed from the signup form. 951 * 952 * @since 8.0.0 953 */ 954 do_action( 'bp_xprofile_removed_signup_field' ); 955 956 wp_send_json_success(); 957 } 958 add_action( 'wp_ajax_xprofile_remove_signup_field', 'bp_xprofile_ajax_remove_signup_field' ); 757 959 758 960 /** … … 782 984 * 783 985 * @since 1.5.0 986 * @since 8.0.0 Adds the `$is_signup` parameter. 784 987 * 785 988 * @param BP_XProfile_Field $admin_field Admin field. 786 989 * @param object $admin_group Admin group object. 787 990 * @param string $class Classes to append to output. 788 */ 789 function xprofile_admin_field( $admin_field, $admin_group, $class = '' ) { 991 * @param bool $is_signup Whether the admin field output is made inside the signup group. 992 */ 993 function xprofile_admin_field( $admin_field, $admin_group, $class = '', $is_signup = false ) { 790 994 global $field; 791 995 792 $field = $admin_field; 996 $field = $admin_field; 997 $fieldset_id = sprintf( 'draggable_field_%d', $field->id ); 793 998 794 999 // Users admin URL. … … 810 1015 'field_id' => (int) $field->id 811 1016 ), $url . '#tabs-' . (int) $field->group_id ); 812 } ?> 813 814 <fieldset id="draggable_field_<?php echo esc_attr( $field->id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( !empty( $class ) ) echo ' ' . $class; ?>"> 1017 } 1018 1019 // Avoid duplicate IDs into the signup group. 1020 if ( $is_signup ) { 1021 $fieldset_id = sprintf( 'draggable_signup_field_%d', $field->id ); 1022 } 1023 ?> 1024 1025 <fieldset id="<?php echo esc_attr( $fieldset_id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( !empty( $class ) ) echo ' ' . $class; ?>"> 815 1026 <legend> 816 1027 <span> 817 1028 <?php bp_the_profile_field_name(); ?> 818 1029 819 <?php if ( empty( $field->can_delete ) ) : ?><?php esc_html_e( '(Primary)', 'buddypress' ); endif; ?>1030 <?php if ( empty( $field->can_delete ) ) : ?><?php esc_html_e( '(Primary)', 'buddypress' ); endif; ?> 820 1031 <?php bp_the_profile_field_required_label(); ?> 821 <?php if ( bp_xprofile_get_meta( $field->id, 'field', 'signup_position' ) ) : ?><?php esc_html_e( '(Sign-up)', 'buddypress' ); endif; ?> 1032 <?php if ( bp_get_signup_allowed() && $field->get_signup_position() ) : ?> 1033 <span class="bp-signup-field-label"><?php esc_html_e( '(Sign-up)', 'buddypress' );?></span> 1034 <?php endif; ?> 822 1035 <?php if ( bp_get_member_types() ) : echo $field->get_member_type_label(); endif; ?> 823 1036 … … 865 1078 <a class="button edit" href="<?php echo esc_url( $field_edit_url ); ?>"><?php _ex( 'Edit', 'Edit field link', 'buddypress' ); ?></a> 866 1079 867 <?php if ( $field->can_delete ) : ?>1080 <?php if ( $field->can_delete && ! $is_signup ) : ?> 868 1081 869 1082 <div class="delete-button"> 870 1083 <a class="confirm submit-delete deletion" href="<?php echo esc_url( wp_nonce_url( $field_delete_url, 'bp_xprofile_delete_field-' . $field->id, 'bp_xprofile_delete_field' ) ); ?>"><?php _ex( 'Delete', 'Delete field link', 'buddypress' ); ?></a> 1084 </div> 1085 1086 <?php endif; ?> 1087 1088 <?php if ( $field->can_delete && $is_signup ) : ?> 1089 1090 <div class="delete-button"> 1091 <a class="submit-delete removal" href="<?php echo esc_attr( sprintf( '#remove_field-%d', $field->id ) ); ?>"><?php echo esc_html_x( 'Remove', 'Remove field link', 'buddypress' ); ?></a> 871 1092 </div> 872 1093 … … 888 1109 </div> 889 1110 </fieldset> 890 891 1111 <?php 1112 } 1113 1114 /** 1115 * Handles the WYSIWYG display of signup profile fields on the edit screen. 1116 * 1117 * @since 8.0.0 1118 * 1119 * @param BP_XProfile_Field $signup_field The field to use into the signup form. 1120 * @param object $field_group The real field group object. 1121 * @param string $class Classes to append to output. 1122 * @param bool $echo Whether to return or display the HTML output. 1123 * @return string The HTML output. 1124 */ 1125 function bp_xprofile_admin_get_signup_field( $signup_field, $field_group = null, $class = '', $echo = false ) { 1126 add_filter( 'bp_get_the_profile_field_input_name', 'bp_get_the_profile_signup_field_input_name' ); 1127 1128 if ( ! $echo ) { 1129 // Set up an output buffer. 1130 ob_start(); 1131 xprofile_admin_field( $signup_field, $field_group, $class, true ); 1132 $output = ob_get_contents(); 1133 ob_end_clean(); 1134 } else { 1135 xprofile_admin_field( $signup_field, $field_group, $class, true ); 1136 } 1137 1138 remove_filter( 'bp_get_the_profile_field_input_name', 'bp_get_the_profile_signup_field_input_name' ); 1139 1140 if ( ! $echo ) { 1141 return $output; 1142 } 892 1143 } 893 1144 -
trunk/src/bp-xprofile/bp-xprofile-cache.php
r12869 r12886 315 315 } 316 316 add_action( 'profile_update', 'bp_xprofile_reset_user_mid_cache', 10, 1 ); 317 318 /** 319 * Resets the signup field IDs cache. 320 * 321 * @since 8.0.0 322 */ 323 function bp_xprofile_reset_signup_field_cache() { 324 wp_cache_delete( 'signup_fields', 'bp_xprofile' ); 325 } 326 add_action( 'bp_xprofile_inserted_signup_field', 'bp_xprofile_reset_signup_field_cache' ); 327 add_action( 'bp_xprofile_reordered_signup_fields', 'bp_xprofile_reset_signup_field_cache' ); 328 add_action( 'bp_xprofile_removed_signup_field', 'bp_xprofile_reset_signup_field_cache' ); -
trunk/src/bp-xprofile/bp-xprofile-cssjs.php
r12868 r12886 58 58 'hide_required_metabox' => array(), 59 59 'hide_member_types_metabox' => array(), 60 'hide_signup_position_metabox' => array(), 60 61 'text' => array( 61 62 'defaultValue' => __( 'Default Value', 'buddypress' ), 62 63 'deleteLabel' => __( 'Delete', 'buddypress' ), 63 64 ), 65 'signup_info' => _x( '(Sign-up)', 'xProfile Group Admin Screen Signup field information', 'buddypress' ), 64 66 ); 65 67
Note: See TracChangeset
for help on using the changeset viewer.