Skip to:
Content

BuddyPress.org

Ticket #6290: 6290.wp39.patch

File 6290.wp39.patch, 3.2 KB (added by imath, 4 years ago)
  • src/bp-core/bp-core-attachments.php

    diff --git src/bp-core/bp-core-attachments.php src/bp-core/bp-core-attachments.php
    index d454d88..a7b2399 100644
     
    66 * @subpackage Attachments
    77 */
    88
     9
    910// Exit if accessed directly
    1011defined( 'ABSPATH' ) || exit;
    1112
    1213/**
     14 * Check if the current WordPress version is using Plupload 2.1.1
     15 *
     16 * Plupload 2.1.1 was introduced in WordPress 3.9. Our bp-plupload.js
     17 * script requires it. So we need to make sure the current WordPress
     18 * match with our needs.
     19 *
     20 * @since  BuddyPress (2.3.0)
     21 *
     22 * @return bool True if WordPress is 3.9+, false otherwise
     23 */
     24function bp_attachments_is_wp_version_supported() {
     25        return (bool) version_compare( bp_get_major_wp_version(), '3.9', '>=' );
     26}
     27
     28/**
    1329 * Get the BuddyPress Plupload settings
    1430 *
    1531 * @since  BuddyPress (2.3.0)
  • src/bp-core/bp-core-avatars.php

    diff --git src/bp-core/bp-core-avatars.php src/bp-core/bp-core-avatars.php
    index 8457c03..7ef2019 100644
    add_action( 'bp_parse_query', 'bp_core_avatar_reset_query', 10, 1 ); 
    17931793function bp_avatar_is_front_edit() {
    17941794        $retval = false;
    17951795
     1796        // No need to carry on if the current WordPress version is not supported.
     1797        if ( ! bp_attachments_is_wp_version_supported() ) {
     1798                return $retval;
     1799        }
     1800
    17961801        if ( bp_is_user_change_avatar() && 'crop-image' !== bp_get_avatar_admin_step() ) {
    17971802                $retval = ! bp_core_get_root_option( 'bp-disable-avatar-uploads' );
    17981803        }
  • src/bp-xprofile/bp-xprofile-admin.php

    diff --git src/bp-xprofile/bp-xprofile-admin.php src/bp-xprofile/bp-xprofile-admin.php
    index 27376e6..1fb255a 100644
    class BP_XProfile_User_Admin { 
    690690         * @since BuddyPress (2.3.0)
    691691         */
    692692        public function enqueue_scripts( $screen_id ) {
    693                 if ( ( false === strpos( $screen_id, 'users_page_bp-profile-edit' ) && false === strpos( $screen_id, 'profile_page_bp-profile-edit' ) ) || bp_core_get_root_option( 'bp-disable-avatar-uploads' ) || ! buddypress()->avatar->show_avatars ) {
     693                if ( ( false === strpos( $screen_id, 'users_page_bp-profile-edit' )
     694                        && false === strpos( $screen_id, 'profile_page_bp-profile-edit' ) )
     695                        || bp_core_get_root_option( 'bp-disable-avatar-uploads' )
     696                        || ! buddypress()->avatar->show_avatars
     697                        || ! bp_attachments_is_wp_version_supported() ) {
    694698                        return;
    695699                }
    696700
    class BP_XProfile_User_Admin { 
    10691073
    10701074                        <?php endif;
    10711075
    1072                         // Load the Avatar UI templates if user avatar uploads are enabled
    1073                         if ( ! bp_core_get_root_option( 'bp-disable-avatar-uploads' ) ) : ?>
     1076                        // Load the Avatar UI templates if user avatar uploads are enabled and current WordPress version is supported
     1077                        if ( ! bp_core_get_root_option( 'bp-disable-avatar-uploads' ) && bp_attachments_is_wp_version_supported() ) : ?>
    10741078                                <a href="#TB_inline?width=800px&height=400px&inlineId=bp-xprofile-avatar-editor" title="<?php esc_attr_e( 'Edit Profile Photo', 'buddypress' );?>" class="thickbox bp-xprofile-avatar-user-edit"><?php esc_html_e( 'Edit Profile Photo', 'buddypress' ); ?></a>
    10751079                                <div id="bp-xprofile-avatar-editor" style="display:none;">
    10761080                                        <?php bp_attachments_get_template_part( 'avatars/index' ); ?>