Skip to:
Content

BuddyPress.org

Changeset 11345


Ignore:
Timestamp:
12/26/2016 09:51:30 PM (3 years ago)
Author:
slaffik
Message:

Profile: redirect to group after profile field deleted.

When deleting a profile field we should redirect back to a fields group, where the field was deleted from. That's a UX improvement.

Props rogercoathup, DJPaul.
Fixes #4646.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-admin.php

    r11127 r11345  
    561561    global $field;
    562562
    563     $field = $admin_field; ?>
    564 
    565     <fieldset id="draggable_field_<?php echo esc_attr( $field->id ); ?>"class="sortable<?php echo ' ' . $field->type; if ( !empty( $class ) ) echo ' ' . $class; ?>">
     563    $field = $admin_field;
     564
     565    $field_edit_url = add_query_arg(
     566        array(
     567            'page'     => 'bp-profile-setup',
     568            'group_id' => (int) $field->group_id,
     569            'field_id' => (int) $field->id,
     570            'mode'     => 'edit_field'
     571        ),
     572        admin_url( 'users.php' )
     573    );
     574
     575    if ( $field->can_delete ) {
     576        $field_delete_url = add_query_arg(
     577            array(
     578                'page'     => 'bp-profile-setup',
     579                'field_id' => (int) $field->id,
     580                'mode'     => 'delete_field'
     581            ),
     582            admin_url( 'users.php' ) . '#tabs-' . (int) $field->group_id
     583        );
     584    }
     585    ?>
     586
     587    <fieldset id="draggable_field_<?php echo esc_attr( $field->id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( !empty( $class ) ) echo ' ' . $class; ?>">
    566588        <legend>
    567589            <span>
     
    614636
    615637            <div class="actions">
    616                 <a class="button edit" href="users.php?page=bp-profile-setup&amp;group_id=<?php echo esc_attr( $admin_group->id ); ?>&amp;field_id=<?php echo esc_attr( $field->id ); ?>&amp;mode=edit_field"><?php _e( 'Edit', 'buddypress' ); ?></a>
     638                <a class="button edit" href="<?php echo esc_url( $field_edit_url ); ?>"><?php _e( 'Edit', 'buddypress' ); ?></a>
    617639
    618640                <?php if ( $field->can_delete ) : ?>
    619641
    620642                    <div class="delete-button">
    621                         <a class="confirm submit-delete deletion" href="users.php?page=bp-profile-setup&amp;field_id=<?php echo esc_attr( $field->id ); ?>&amp;mode=delete_field"><?php _e( 'Delete', 'buddypress' ); ?></a>
     643                        <a class="confirm submit-delete deletion" href="<?php echo esc_url( $field_delete_url ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
    622644                    </div>
    623645
Note: See TracChangeset for help on using the changeset viewer.