Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/16/2021 05:32:04 AM (3 years ago)
Author:
imath
Message:

Use drag and drop into the xProfile Admin UI to to set signup fields

  • Create a new "Signup Fields" tab to list signup fields. By default this tab will include the primary field (Name).
  • The install process has been adapted to make sure this is the case.
  • An upgrade task is migrating fields into the primary group as signup fields.
  • Make it possible to drag fields from any group into the "Signup Fields" one.
  • Make it possible to use drag and drop to reorder signup fields from the corresponding tab.
  • Include a link on each field entry (except the primary one) to remove the field from this "Signup Fields" field group.

Props johnjamesjacoby, boonebgorges, DJPaul, Offereins

See #6347

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-update.php

    r12851 r12886  
    599599 *
    600600 * - Edit the `new_avatar` activity type's component to `members`.
     601 * - Upgrade Primary xProfile Group's fields to signup fields.
    601602 *
    602603 * @since 8.0.0
     
    622623        )
    623624    );
     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    }
    624654}
    625655
Note: See TracChangeset for help on using the changeset viewer.