Changeset 394 for trunk/bp-core/bp-core-avatars.php
- Timestamp:
- 10/23/2008 12:56:37 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-avatars.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-avatars.php
r391 r394 19 19 20 20 function bp_core_get_avatar( $user, $version = 1, $no_tag = false, $width = null, $height = null ) { 21 global $bp, $current_blog; 22 21 23 if ( !is_int($version) ) 22 24 $version = (int) $version; … … 25 27 $version = 1; 26 28 27 if ( $home_base_id = get_usermeta( $user, 'home_base' ) )28 $url = get_blog_option($home_base_id, 'siteurl');29 30 29 if ( !$width ) 31 30 $width = constant('CORE_AVATAR_V' . $version . '_W'); … … 34 33 $height = constant('CORE_AVATAR_V' . $version . '_H'); 35 34 36 $str = get_usermeta( $user, "bp_core_avatar_v$version" ); 37 38 if ( strlen($str) ) { 35 36 $avatar_file = get_usermeta( $user, "bp_core_avatar_v$version" ); 37 $url = $bp['root_domain'] . '/' . $avatar_file; 38 39 if ( strlen($avatar_file) ) { 39 40 if ( $no_tag ) 40 return $ str;41 return $url; 41 42 else 42 return '<img src="' . $url . ' /' . $str . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />';43 return '<img src="' . $url . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />'; 43 44 } else { 45 $identicon = 'http://www.gravatar.com/avatar/' . md5( $user . '@buddypress.org') . '?d=wavatar&s='; 44 46 if ( $no_tag ) 45 return CORE_DEFAULT_AVATAR_THUMB;47 return $identicon . constant('CORE_AVATAR_V' . $version . '_W'); 46 48 else 47 return '<img src="' . CORE_DEFAULT_AVATAR. '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />';49 return '<img src="' . $identicon . constant('CORE_AVATAR_V' . $version . '_W') . '" alt="" class="avatar" width="' . $width . '" height="' . $height . '" />'; 48 50 } 49 51 } … … 72 74 73 75 // Main UI Rendering 74 function bp_core_avatar_admin( $message = null , $action = null, $delete_action = null) {76 function bp_core_avatar_admin( $message = null ) { 75 77 global $wp_upload_error; 76 78 ?> … … 90 92 91 93 <?php 92 if ( !$action ) 93 $action = site_url() . '/wp-admin/admin.php?page=bp-xprofile.php'; 94 95 if ( !$delete_action ) 96 $delete_action = site_url() . '/wp-admin/admin.php?page=bp-xprofile.php&slick_avatars_action=delete'; 97 94 98 95 bp_core_render_avatar_upload_form($action); 99 96 … … 132 129 133 130 if ( !bp_core_check_avatar_size($_FILES) ) 134 bp_core_ap_die( 'The file you uploaded is too big. Please upload a file under ' . size_format( 1024 *CORE_MAX_FILE_SIZE) );131 bp_core_ap_die( 'The file you uploaded is too big. Please upload a file under ' . size_format(CORE_MAX_FILE_SIZE) ); 135 132 136 133 if ( !bp_core_check_avatar_type($_FILES) ) … … 148 145 $canvas = $original; 149 146 150 // Render the cropper UI 151 if ( !$action ) 152 $action = get_option('home') .'/wp-admin/admin.php?page=bp-xprofile.php'; 153 147 // Render the cropper UI 154 148 bp_core_render_avatar_cropper($original, $canvas, $action); 155 149 … … 258 252 $user_id = $bp['loggedin_userid']; 259 253 260 if ( !$url ) { 261 $home_base_id = get_usermeta( $user_id, 'home_base' ); 262 $url = get_blog_option($home_base_id, 'siteurl'); 263 } 264 265 $src = str_replace( array(ABSPATH), array($url . '/'), $new ); 254 $src = str_replace( array(ABSPATH), array(site_url() . '/'), $new ); 266 255 267 256 // Load cropper details … … 401 390 } 402 391 403 function bp_core_avatar_save( $vars, $user_id = false , $upload_dir = false, $url = false) {392 function bp_core_avatar_save( $vars, $user_id = false ) { 404 393 if ( !$user_id ) 405 394 $user_id = get_current_user_id(); 406 407 if ( !$url ) {408 $home_base_id = get_usermeta( $user_id, 'home_base' );409 $url = get_blog_option($home_base_id, 'siteurl');410 }411 395 412 396 $old = get_usermeta( $user_id, 'bp_core_avatar_v1_path' ); … … 458 442 function bp_core_ap_die( $msg ) { 459 443 echo '<p><strong>' . $msg . '</strong></p>'; 460 echo '<p><a href="' . get_option('home') .'/wp-admin/admin.php?page=bp-xprofile.php">' . __('Try Again', 'buddypress') . '</a></p>';444 echo '<p><a href="' . $bp['loggedin_domain'] . '/' . $bp['profile']['slug'] . '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>'; 461 445 echo '</div>'; 462 446 exit;
Note: See TracChangeset
for help on using the changeset viewer.