Show
Ignore:
Timestamp:
06/19/08 17:10:30 (7 months ago)
Author:
apeatling
Message:

Fixed issues with subdirectory WPMU installations and BuddyPress

Files:
1 modified

Legend:

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

    r166 r167  
    6767 
    6868// Main UI Rendering 
    69 function xprofile_avatar_admin($message = null) { 
     69function xprofile_avatar_admin($message = null, $action = null) { 
    7070        ?>       
    7171        <?php if ( !isset($_POST['slick_avatars_action']) && !isset($_GET['slick_avatars_action']) ) { ?> 
     
    8484                 
    8585                <?php 
    86                 $action = get_option('home') . '/wp-admin/admin.php?page=bp-xprofile.php'; 
     86                if ( !$action ) 
     87                        $action = get_option('home') . '/wp-admin/admin.php?page=bp-xprofile.php'; 
     88                 
    8789                xprofile_render_avatar_upload_form($action); 
    8890 
     
    128130                 
    129131                // Render the cropper UI 
    130                 $action = get_option('home') .'/wp-admin/admin.php?page=bp-xprofile.php'; 
     132                if ( !$action ) 
     133                        $action = get_option('home') .'/wp-admin/admin.php?page=bp-xprofile.php'; 
     134                 
    131135                xprofile_render_avatar_cropper($original, $canvas, $action); 
    132136                 
     
    224228} 
    225229 
    226 function xprofile_render_avatar_cropper($original, $new, $action) { 
     230function xprofile_render_avatar_cropper($original, $new, $action, $user_id = null) { 
    227231        $size = getimagesize($new); 
    228232         
    229         // Get the URL to access the uploaded file 
    230         $url = get_usermeta( get_current_user_id(), 'source_domain' ); 
     233        if ( !$user_id ) 
     234                $user_id = get_current_user_id(); 
     235         
     236        if ( VHOST == 'yes' ) { 
     237                $url = 'http://' . get_usermeta( $user_id, 'source_domain' ) . '/'; 
     238        } else { 
     239                $url = 'http://' . get_usermeta( $user_id, 'source_domain' ) . '/' . get_usermeta( $user_id, 'nickname' ) . '/'; 
     240        } 
     241 
    231242        $src = str_replace( array(ABSPATH), array($url . '/'), $new ); 
    232          
     243 
    233244        // Load cropper details 
    234245         
     
    354365        if ( !$user_id ) 
    355366                $user_id = get_current_user_id(); 
     367                 
     368        if ( VHOST == 'yes' ) { 
     369                $src = 'http://' . get_usermeta( $user_id, 'source_domain' ) . '/'; 
     370        } else { 
     371                $src = 'http://' . get_usermeta( $user_id, 'source_domain' ) . '/' . get_usermeta( $user_id, 'nickname' ) . '/'; 
     372        } 
    356373         
    357374        $old = get_usermeta( $user_id, 'xprofile_avatar_v1_path' ); 
    358         $v1_href = str_replace( array(ABSPATH), array( 'http://' . get_usermeta( get_current_user_id(), 'source_domain' ) . '/' ), $vars['v1_out'] ); 
     375        $v1_href = str_replace( array(ABSPATH), array($src), $vars['v1_out'] ); 
    359376        update_usermeta( $user_id, 'xprofile_avatar_v1', $v1_href ); 
    360377        update_usermeta( $user_id, 'xprofile_avatar_v1_path', $vars['v1_out'] ); 
     
    363380        if ( XPROFILE_AVATAR_V2_W !== false && XPROFILE_AVATAR_V2_H !== false ) { 
    364381                $old = get_usermeta( $user_id, 'xprofile_avatar_v2_path' ); 
    365                 $v2_href = str_replace( array(ABSPATH), array( 'http://' . get_usermeta( get_current_user_id(), 'source_domain' ) . '/' ), $vars['v2_out'] ); 
     382                $v2_href = str_replace( array(ABSPATH), array($src), $vars['v2_out'] ); 
    366383                update_usermeta( $user_id, 'xprofile_avatar_v2', $v2_href ); 
    367384                update_usermeta( $user_id, 'xprofile_avatar_v2_path', $vars['v2_out'] );