Skip to:
Content

BuddyPress.org


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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.