Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/12/2010 12:31:49 PM (16 years ago)
Author:
apeatling
Message:

Fixing the use of deprecated template tags in bp-default. Merged the fetching of BP runtime settings into one query to significantly reduce the number of run time database hits. Fixed #1916

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-avatars.php

    r2418 r2695  
    88 * Set up the constants we need for avatar support
    99 */
    10 
    11 if ( !defined( 'BP_AVATAR_UPLOAD_PATH' ) )
    12         define( 'BP_AVATAR_UPLOAD_PATH', bp_core_avatar_upload_path() );
    13 
    14 if ( !defined( 'BP_AVATAR_URL' ) )
    15         define( 'BP_AVATAR_URL', bp_core_avatar_url() );
    16 
    17 if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) )
    18         define( 'BP_AVATAR_THUMB_WIDTH', 50 );
    19 
    20 if ( !defined( 'BP_AVATAR_THUMB_HEIGHT' ) )
    21         define( 'BP_AVATAR_THUMB_HEIGHT', 50 );
    22 
    23 if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
    24         define( 'BP_AVATAR_FULL_WIDTH', 150 );
    25 
    26 if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
    27         define( 'BP_AVATAR_FULL_HEIGHT', 150 );
    28 
    29 if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_WIDTH' ) )
    30         define( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 450 );
    31 
    32 if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) ) {
    33         if ( !get_site_option( 'fileupload_maxk' ) )
    34                 define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 ); /* 5mb */
    35         else
    36                 define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', get_site_option( 'fileupload_maxk' ) * 1024 );
    37 }
    38 
    39 if ( !defined( 'BP_AVATAR_DEFAULT' ) )
    40         define( 'BP_AVATAR_DEFAULT', BP_PLUGIN_URL . '/bp-xprofile/images/none.gif' );
    41 
    42 if ( !defined( 'BP_AVATAR_DEFAULT_THUMB' ) )
    43         define( 'BP_AVATAR_DEFAULT_THUMB', BP_PLUGIN_URL . '/bp-xprofile/images/none-thumbnail.gif' );
     10function bp_core_set_avatar_constants() {
     11        global $bp;
     12
     13        if ( !defined( 'BP_AVATAR_UPLOAD_PATH' ) )
     14                define( 'BP_AVATAR_UPLOAD_PATH', bp_core_avatar_upload_path() );
     15
     16        if ( !defined( 'BP_AVATAR_URL' ) )
     17                define( 'BP_AVATAR_URL', bp_core_avatar_url() );
     18
     19        if ( !defined( 'BP_AVATAR_THUMB_WIDTH' ) )
     20                define( 'BP_AVATAR_THUMB_WIDTH', 50 );
     21
     22        if ( !defined( 'BP_AVATAR_THUMB_HEIGHT' ) )
     23                define( 'BP_AVATAR_THUMB_HEIGHT', 50 );
     24
     25        if ( !defined( 'BP_AVATAR_FULL_WIDTH' ) )
     26                define( 'BP_AVATAR_FULL_WIDTH', 150 );
     27
     28        if ( !defined( 'BP_AVATAR_FULL_HEIGHT' ) )
     29                define( 'BP_AVATAR_FULL_HEIGHT', 150 );
     30
     31        if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_WIDTH' ) )
     32                define( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 450 );
     33
     34        if ( !defined( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE' ) ) {
     35                if ( !$bp->site_options['fileupload_maxk'] )
     36                        define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', 5120000 ); /* 5mb */
     37                else
     38                        define( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $bp->site_options['fileupload_maxk'] * 1024 );
     39        }
     40
     41        if ( !defined( 'BP_AVATAR_DEFAULT' ) )
     42                define( 'BP_AVATAR_DEFAULT', BP_PLUGIN_URL . '/bp-xprofile/images/none.gif' );
     43
     44        if ( !defined( 'BP_AVATAR_DEFAULT_THUMB' ) )
     45                define( 'BP_AVATAR_DEFAULT_THUMB', BP_PLUGIN_URL . '/bp-xprofile/images/none-thumbnail.gif' );
     46}
     47add_action( 'bp_init', 'bp_core_set_avatar_constants' );
    4448
    4549function bp_core_fetch_avatar( $args = '' ) {
Note: See TracChangeset for help on using the changeset viewer.