Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/29/2020 03:38:06 PM (16 months ago)
Author:
imath
Message:

Move Avatars & Cover from xProfile to Members component : step 3

Move the Avatar upload directory filter from the xProfile functions to the Members functions.
Move the Avatar template functions from xProfile to the Members component.

See #8156

File:
1 edited

Legend:

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

    r12533 r12555  
    707707
    708708/**
    709  * Setup the avatar upload directory for a user.
    710  *
    711  * @since 1.0.0
    712  *
    713  * @package BuddyPress Core
    714  *
    715  * @param string $directory The root directory name. Optional.
    716  * @param int    $user_id   The user ID. Optional.
    717  * @return array Array containing the path, URL, and other helpful settings.
    718  */
    719 function xprofile_avatar_upload_dir( $directory = 'avatars', $user_id = 0 ) {
    720 
    721     // Use displayed user if no user ID was passed.
    722     if ( empty( $user_id ) ) {
    723         $user_id = bp_displayed_user_id();
    724     }
    725 
    726     // Failsafe against accidentally nooped $directory parameter.
    727     if ( empty( $directory ) ) {
    728         $directory = 'avatars';
    729     }
    730 
    731     $path      = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id;
    732     $newbdir   = $path;
    733     $newurl    = bp_core_avatar_url() . '/' . $directory. '/' . $user_id;
    734     $newburl   = $newurl;
    735     $newsubdir = '/' . $directory. '/' . $user_id;
    736 
    737     /**
    738      * Filters the avatar upload directory for a user.
    739      *
    740      * @since 1.1.0
    741      *
    742      * @param array $value Array containing the path, URL, and other helpful settings.
    743      */
    744     return apply_filters( 'xprofile_avatar_upload_dir', array(
    745         'path'    => $path,
    746         'url'     => $newurl,
    747         'subdir'  => $newsubdir,
    748         'basedir' => $newbdir,
    749         'baseurl' => $newburl,
    750         'error'   => false
    751     ) );
    752 }
    753 
    754 /**
    755709 * When search_terms are passed to BP_User_Query, search against xprofile fields.
    756710 *
Note: See TracChangeset for help on using the changeset viewer.