diff --git src/bp-core/bp-core-attachments.php src/bp-core/bp-core-attachments.php
index d454d88..e059c43 100644
|
|
|
function bp_attachments_get_plupload_l10n() { |
| 98 | 98 | 'dismiss' => __( 'Dismiss', 'buddypress' ), |
| 99 | 99 | 'crunching' => __( 'Crunching…', 'buddypress' ), |
| 100 | 100 | 'unique_file_warning' => __( 'Make sure to upload a unique file', 'buddypress' ), |
| 101 | | 'error_uploading' => __( '“%s” has failed to upload.', 'buddypress' ) |
| | 101 | 'error_uploading' => __( '“%s” has failed to upload.', 'buddypress' ), |
| | 102 | 'has_avatar_warning' => __( 'If you'd like to delete your current profile photo but not upload a new one, please use the delete tab.', 'buddypress' ) |
| 102 | 103 | ) ); |
| 103 | 104 | } |
| 104 | 105 | |
diff --git src/bp-core/bp-core-avatars.php src/bp-core/bp-core-avatars.php
index 8457c03..94e42bf 100644
|
|
|
function bp_avatar_ajax_upload() { |
| 947 | 947 | } |
| 948 | 948 | } |
| 949 | 949 | |
| | 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 | |
| 950 | 963 | if ( empty( $avatar ) ) { |
| 951 | 964 | // 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 | | ); |
| | 965 | $message = __( 'Upload failed.', 'buddypress' ); |
| 961 | 966 | |
| 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 | // Use the template message if set |
| | 968 | if ( ! empty( $feedback_message ) ) { |
| | 969 | $message = $feedback_message; |
| 967 | 970 | } |
| 968 | 971 | |
| 969 | | bp_attachments_json_response( false, $is_html4, $message ); |
| | 972 | // Upload error reply |
| | 973 | bp_attachments_json_response( false, $is_html4, array( |
| | 974 | 'type' => 'upload_error', |
| | 975 | 'message' => $message, |
| | 976 | ) ); |
| 970 | 977 | } |
| 971 | 978 | |
| 972 | 979 | if ( empty( $bp->avatar_admin->image->file ) ) { |
| … |
… |
function bp_avatar_ajax_upload() { |
| 990 | 997 | 'url' => $bp->avatar_admin->image->url, |
| 991 | 998 | 'width' => $uploaded_image[0], |
| 992 | 999 | 'height' => $uploaded_image[1], |
| | 1000 | 'feedback' => $feedback_message, |
| 993 | 1001 | ) ); |
| 994 | 1002 | } |
| 995 | 1003 | add_action( 'wp_ajax_bp_avatar_upload', 'bp_avatar_ajax_upload' ); |
diff --git src/bp-core/css/avatar.css src/bp-core/css/avatar.css
index d11d853..d3434e4 100644
|
|
|
div.bp-avatar-status .bp-bar { |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | #bp-uploader-warning, #bp-webcam-message p.warning { |
| 53 | | background-color: #ffec8b; |
| 54 | | border: 1px solid #fc0; |
| | 53 | background-color: #ffd; |
| | 54 | border: 1px solid #cb2; |
| 55 | 55 | color: #440; |
| 56 | 56 | display: block; |
| 57 | 57 | font-size: 90%; |
| … |
… |
div.bp-avatar-nav { |
| 281 | 281 | width: auto; |
| 282 | 282 | } |
| 283 | 283 | |
| | 284 | .bp-avatar .item { |
| | 285 | overflow:hidden; |
| | 286 | } |
| | 287 | |
| 284 | 288 | .bp-avatar .avatar-crop-management.adjust { |
| 285 | 289 | float: left; |
| 286 | 290 | clear: none; |
diff --git src/bp-core/js/avatar.js src/bp-core/js/avatar.js
index aad00be..bb032c1 100644
|
|
|
window.bp = window.bp || {}; |
| 26 | 26 | // Init some vars |
| 27 | 27 | this.views = new Backbone.Collection(); |
| 28 | 28 | this.jcropapi = {}; |
| | 29 | this.warning = null; |
| 29 | 30 | |
| 30 | 31 | // Set up nav |
| 31 | 32 | this.setupNav(); |
| … |
… |
window.bp = window.bp || {}; |
| 349 | 350 | |
| 350 | 351 | avatarStatus.inject( '.bp-avatar-status' ); |
| 351 | 352 | } ); |
| | 353 | }, |
| | 354 | |
| | 355 | removeWarning: function() { |
| | 356 | if ( ! _.isNull( this.warning ) ) { |
| | 357 | this.warning.remove(); |
| | 358 | } |
| | 359 | }, |
| | 360 | |
| | 361 | displayWarning: function( message ) { |
| | 362 | this.removeWarning(); |
| | 363 | |
| | 364 | this.warning = new bp.Views.uploaderWarning( { |
| | 365 | value: message |
| | 366 | } ); |
| | 367 | |
| | 368 | this.warning.inject( '.bp-avatar-status' ); |
| 352 | 369 | } |
| 353 | 370 | }; |
| 354 | 371 | |
| … |
… |
window.bp = window.bp || {}; |
| 362 | 379 | }, |
| 363 | 380 | |
| 364 | 381 | initialize: function() { |
| | 382 | var hasAvatar = _.findWhere( this.collection.models, { id: 'delete' } ); |
| | 383 | |
| | 384 | // Display a message to inform about the delete tab |
| | 385 | if ( 1 !== hasAvatar.get( 'hide' ) ) { |
| | 386 | bp.Avatar.displayWarning( BP_Uploader.strings.has_avatar_warning ); |
| | 387 | } |
| | 388 | |
| 365 | 389 | _.each( this.collection.models, this.addNavItem, this ); |
| 366 | 390 | this.collection.on( 'change:hide', this.showHideNavItem, this ); |
| 367 | 391 | }, |
| … |
… |
window.bp = window.bp || {}; |
| 405 | 429 | toggleView: function( event ) { |
| 406 | 430 | event.preventDefault(); |
| 407 | 431 | |
| | 432 | // First make sure to remove all warnings |
| | 433 | bp.Avatar.removeWarning(); |
| | 434 | |
| 408 | 435 | var active = $( event.target ).data( 'nav' ); |
| 409 | 436 | |
| 410 | 437 | _.each( this.collection.models, function( model ) { |
| … |
… |
window.bp = window.bp || {}; |
| 488 | 515 | aspectRatio : 1 |
| 489 | 516 | } ); |
| 490 | 517 | |
| | 518 | // Display a warning if the image is smaller than minimum advised |
| | 519 | if ( false !== this.model.get( 'feedback' ) ) { |
| | 520 | bp.Avatar.displayWarning( this.model.get( 'feedback' ) ); |
| | 521 | } |
| | 522 | |
| 491 | 523 | this.on( 'ready', this.initCropper ); |
| 492 | 524 | }, |
| 493 | 525 | |