Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/30/2015 07:57:11 PM (10 years ago)
Author:
imath
Message:

Avatar UI : improve user feedback messages

  • Display a message informing the user can delete his current avatar using the "Delete" tab of the UI.
  • Eventually display a message informing the user the image uploaded have smaller dimensions than the avatar full dimensions.

Props r-a-y

See #6290

File:
1 edited

Legend:

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

    r9819 r9826  
    948948    }
    949949
     950    // Init the feedback message
     951    $feedback_message = false;
     952
     953    if ( ! empty( $bp->template_message ) ) {
     954        $feedback_message = $bp->template_message;
     955
     956        // Remove template message.
     957        $bp->template_message      = false;
     958        $bp->template_message_type = false;
     959        @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
     960        @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
     961    }
     962
    950963    if ( empty( $avatar ) ) {
    951964        // Default upload error
    952         $message = array();
    953 
    954         // Intercept the template message and remove it
    955         if ( ! empty( $bp->template_message ) ) {
    956             // Set the feedback message
    957             $message = array(
    958                 'type'    => 'upload_error',
    959                 'message' => $bp->template_message,
    960             );
    961 
    962             // Remove template message.
    963             $bp->template_message      = false;
    964             $bp->template_message_type = false;
    965             @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH );
    966             @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH );
    967         }
    968 
    969         bp_attachments_json_response( false, $is_html4, $message );
     965        $message = __( 'Upload failed.', 'buddypress' );
     966
     967        // Use the template message if set
     968        if ( ! empty( $feedback_message ) ) {
     969            $message = $feedback_message;
     970        }
     971
     972        // Upload error reply
     973        bp_attachments_json_response( false, $is_html4, array(
     974            'type'    => 'upload_error',
     975            'message' => $message,
     976        ) );
    970977    }
    971978
     
    991998        'width'     => $uploaded_image[0],
    992999        'height'    => $uploaded_image[1],
     1000        'feedback'  => $feedback_message,
    9931001    ) );
    9941002}
Note: See TracChangeset for help on using the changeset viewer.