Skip to:
Content

BuddyPress.org

Changeset 9625


Ignore:
Timestamp:
03/17/2015 06:42:02 PM (11 years ago)
Author:
imath
Message:

Do some clean up in avatar uploads directory filters

Let WordPress creates the uploads directory for us.

Props johnjamesjacoby

See #6278

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r9490 r9625  
    818818        }
    819819
    820         $path    = bp_core_avatar_upload_path() . '/group-avatars/' . $group_id;
    821         $newbdir = $path;
    822 
    823         if ( !file_exists( $path ) )
    824                 @wp_mkdir_p( $path );
    825 
    826         $newurl    = bp_core_avatar_url() . '/group-avatars/' . $group_id;
     820        $directory = 'group-avatars';
     821        $path      = bp_core_avatar_upload_path() . '/' . $directory . '/' . $group_id;
     822        $newbdir   = $path;
     823        $newurl    = bp_core_avatar_url() . '/' . $directory . '/' . $group_id;
    827824        $newburl   = $newurl;
    828         $newsubdir = '/group-avatars/' . $group_id;
     825        $newsubdir = '/' . $directory . '/' . $group_id;
    829826
    830827        /**
     
    835832         * @param array $value Array of parts related to the groups avatar upload directory.
    836833         */
    837         return apply_filters( 'groups_avatar_upload_dir', array( 'path' => $path, 'url' => $newurl, 'subdir' => $newsubdir, 'basedir' => $newbdir, 'baseurl' => $newburl, 'error' => false ) );
     834        return apply_filters( 'groups_avatar_upload_dir', array(
     835                'path'    => $path,
     836                'url'     => $newurl,
     837                'subdir'  => $newsubdir,
     838                'basedir' => $newbdir,
     839                'baseurl' => $newburl,
     840                'error'   => false
     841        ) );
    838842}
    839843
  • trunk/src/bp-members/bp-members-functions.php

    r9611 r9625  
    21602160        }
    21612161
    2162         $path  = bp_core_avatar_upload_path() . '/avatars/signups/' . $bp->signup->avatar_dir;
    2163         $newbdir = $path;
    2164 
    2165         if ( ! file_exists( $path ) ) {
    2166                 @wp_mkdir_p( $path );
    2167         }
    2168 
    2169         $newurl = bp_core_avatar_url() . '/avatars/signups/' . $bp->signup->avatar_dir;
    2170         $newburl = $newurl;
    2171         $newsubdir = '/avatars/signups/' . $bp->signup->avatar_dir;
     2162        $directory = 'avatars/signups';
     2163        $path      = bp_core_avatar_upload_path() . '/' . $directory . '/' . $bp->signup->avatar_dir;
     2164        $newbdir   = $path;
     2165        $newurl    = bp_core_avatar_url() . '/' . $directory . '/' . $bp->signup->avatar_dir;
     2166        $newburl   = $newurl;
     2167        $newsubdir = '/' . $directory . '/' . $bp->signup->avatar_dir;
    21722168
    21732169        /**
     
    21842180                'basedir' => $newbdir,
    21852181                'baseurl' => $newburl,
    2186                 'error' => false
     2182                'error'   => false
    21872183        ) );
    21882184}
  • trunk/src/bp-xprofile/bp-xprofile-functions.php

    r9471 r9625  
    681681        }
    682682
    683         $path    = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id;
    684         $newbdir = $path;
    685 
    686         if ( ! file_exists( $path ) ) {
    687                 @wp_mkdir_p( $path );
    688         }
    689 
     683        $path      = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id;
     684        $newbdir   = $path;
    690685        $newurl    = bp_core_avatar_url() . '/' . $directory. '/' . $user_id;
    691686        $newburl   = $newurl;
Note: See TracChangeset for help on using the changeset viewer.