Changeset 13179 for trunk/src/bp-core/bp-core-attachments.php
- Timestamp:
- 12/11/2021 06:52:01 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-attachments.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-attachments.php
r13174 r13179 410 410 // It's an avatar, we need to crop it. 411 411 if ( 'avatar' === $type ) { 412 $created = bp_core_avatar_handle_crop( array( 413 'object' => $r['object'], 414 'avatar_dir' => trim( dirname( $attachment_data['subdir'] ), '/' ), 415 'item_id' => (int) $r['item_id'], 416 'original_file' => trailingslashit( $attachment_data['subdir'] ) . $image_file_name, 417 'crop_w' => $r['crop_w'], 418 'crop_h' => $r['crop_h'], 419 'crop_x' => $r['crop_x'], 420 'crop_y' => $r['crop_y'] 421 ) ); 412 $created = bp_core_avatar_handle_crop( 413 array( 414 'object' => $r['object'], 415 'avatar_dir' => trim( dirname( $attachment_data['subdir'] ), '/' ), 416 'item_id' => (int) $r['item_id'], 417 'original_file' => trailingslashit( $attachment_data['subdir'] ) . $image_file_name, 418 'crop_w' => $r['crop_w'], 419 'crop_h' => $r['crop_h'], 420 'crop_x' => $r['crop_x'], 421 'crop_y' => $r['crop_y'] 422 ) 423 ); 422 424 423 425 // It's a cover image we need to fit it to feature's dimensions. 424 426 } elseif ( 'cover_image' === $type ) { 425 $cover_image = bp_attachments_cover_image_generate_file( array( 426 'file' => $image_file_path, 427 'component' => $r['component'], 428 'cover_image_dir' => $attachment_data['path'] 429 ) ); 427 $cover_image = bp_attachments_cover_image_generate_file( 428 array( 429 'file' => $image_file_path, 430 'component' => $r['component'], 431 'cover_image_dir' => $attachment_data['path'] 432 ) 433 ); 430 434 431 435 $created = ! empty( $cover_image['cover_file'] ); … … 788 792 $defaults['multi_selection'] = false; 789 793 790 // Does the object already has an avatar set .794 // Does the object already has an avatar set? 791 795 $has_avatar = $defaults['multipart_params']['bp_params']['has_avatar']; 792 796 793 // What is the object the avatar belongs to .797 // What is the object the avatar belongs to? 794 798 $object = $defaults['multipart_params']['bp_params']['object']; 799 800 // Get The item id. 801 $item_id = $defaults['multipart_params']['bp_params']['item_id']; 795 802 796 803 // Init the Avatar nav. 797 804 $avatar_nav = array( 798 'upload' => array( 'id' => 'upload', 'caption' => __( 'Upload', 'buddypress' ), 'order' => 0 ), 799 800 // The delete view will only show if the object has an avatar. 801 'delete' => array( 'id' => 'delete', 'caption' => __( 'Delete', 'buddypress' ), 'order' => 100, 'hide' => (int) ! $has_avatar ), 805 'upload' => array( 806 'id' => 'upload', 807 'caption' => __( 'Upload', 'buddypress' ), 808 'order' => 0 809 ), 810 'delete' => array( 811 'id' => 'delete', 812 'caption' => __( 'Delete', 'buddypress' ), 813 'order' => 100, 814 'hide' => (int) ! $has_avatar 815 ), 802 816 ); 817 818 if ( 'user' === $object ) { 819 // Look inside history to see if the user previously uploaded avatars. 820 $avatars_history = bp_avatar_get_avatars_history( $item_id, $object ); 821 822 if ( $avatars_history ) { 823 ksort( $avatars_history ); 824 $settings['history'] = array_values( $avatars_history ); 825 $settings['historyNonces'] = array( 826 'recylePrevious' => wp_create_nonce( 'bp_avatar_recycle_previous' ), 827 'deletePrevious' => wp_create_nonce( 'bp_avatar_delete_previous' ), 828 ); 829 830 $avatar_nav['recycle'] = array( 831 'id' => 'recycle', 832 'caption' => __( 'Recycle', 'buddypress' ), 833 'order' => 20, 834 'hide' => (int) empty( $avatars_history ), 835 ); 836 } 837 } 803 838 804 839 // Create the Camera Nav if the WebCam capture feature is enabled. 805 840 if ( bp_avatar_use_webcam() && 'user' === $object ) { 806 $avatar_nav['camera'] = array( 'id' => 'camera', 'caption' => __( 'Take Photo', 'buddypress' ), 'order' => 10 ); 841 $avatar_nav['camera'] = array( 842 'id' => 'camera', 843 'caption' => __( 'Take Photo', 'buddypress' ), 844 'order' => 10 845 ); 807 846 808 847 // Set warning messages.
Note: See TracChangeset
for help on using the changeset viewer.