Skip to:
Content

BuddyPress.org

Changeset 436


Ignore:
Timestamp:
10/24/2008 04:00:42 PM (18 years ago)
Author:
apeatling
Message:
  • Fixed avatar upload validation bug when image upload field left blank
  • Fixed incorrect "your" wording on site wide activity widget
  • Fixed profile wire posting bug
  • Updated site wide members directory
Location:
trunk
Files:
3 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-templatetags.php

    r391 r436  
    8585}
    8686
    87 function bp_activity_get_list( $user_id, $title, $limit = false ) {
    88         global $bp_activity_user_id, $bp_activity_limit, $bp_activity_title;
     87function bp_activity_get_list( $user_id, $title, $no_activity, $limit = false ) {
     88        global $bp_activity_user_id, $bp_activity_limit, $bp_activity_title, $bp_activity_no_activity;
    8989       
    9090        $bp_activity_user_id = $user_id;
    9191        $bp_activity_limit = $limit;
    9292        $bp_activity_title = $title;
     93        $bp_activity_no_activity = $no_activity;
    9394       
    9495        load_template( TEMPLATEPATH . '/activity/activity-list.php' );
    … …  
    122123}
    123124
     125function bp_activities_no_activity() {
     126        global $bp_activity_no_activity;
     127        echo $bp_activity_no_activity;
     128}
     129
    124130function bp_activity_content() {
    125131        global $activities_template;
    … …  
    133139}
    134140
    135 function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $is_home = true ) {
     141function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true ) {
    136142        if ( !$content )
    137143                return false;
    … …  
    146152        if ( $insert_time )
    147153                $content[0] = bp_activity_insert_time_since( $content[0], $date_recorded );
     154
     155        /* Switch 'their/your' depending on whether the user is logged in or not and viewing their profile */
     156        if ( $filter_words ) {
     157                $content[0] = str_replace( __('their', 'buddypress'), __('your', 'buddypress'), $content[0] );
     158        }
    148159       
    149         /* Switch 'their/your' and 'Name/You' depending on whether the user is logged in or not and viewing their profile */
    150         if ( $is_home ) {
    151                 $content[0] = str_replace( __('their', 'buddypress'), __('your', 'buddypress'), $content[0] );
    152                 $content[0] = str_replace( $full_name, __('You', 'buddypress'), $content[0] );         
     160        /* Remove the 'You' and replace if with the persons name */
     161        if ( $filter_you ) {
     162                $content[0] = str_replace( $full_name, __('You', 'buddypress'), $content[0] );                         
    153163        }
    154164       
    … …  
    169179
    170180
     181
    171182?>
  • trunk/bp-activity/bp-activity-widgets.php

    r391 r436  
    3535                        <?php foreach( $activity as $item ) : ?>
    3636                                <li class="<?php echo $item['component_name'] ?>">
    37                                         <?php echo bp_activity_content_filter( $item['content'], $item['date_recorded'], false );?>
     37                                        <?php echo bp_activity_content_filter( $item['content'], $item['date_recorded'], '', true, false, true );?>
    3838                                </li>
    3939                        <?php endforeach; ?>
  • trunk/bp-core.php

    r431 r436  
    33/* Define the current version number for checking if DB tables are up to date. */
    44define( 'BP_CORE_VERSION', '0.2.6.1' );
     5
     6/* Define the slug for member pages and the members directory (e.g. domain.com/[members] ) */
     7define( 'MEMBERS_SLUG', 'members' );
     8
     9/* These components are accessed via the root, and not under a blog name or home base.
     10   e.g Groups is accessed via: http://domain.com/groups/group-name NOT http://domain.com.andy/groups/group-name */
     11define( 'BP_CORE_ROOT_COMPONENTS', MEMBERS_SLUG . ',groups' );
    512
    613/* Load the language file */
    714if ( file_exists(ABSPATH . 'wp-content/mu-plugins/bp-languages/buddypress-' . get_locale() . '.mo') )
    815        load_textdomain( 'buddypress', ABSPATH . 'wp-content/mu-plugins/bp-languages/buddypress-' . get_locale() . '.mo' );
    9 
    10 /* These components are accessed via the root, and not under a blog name or home base.
    11    e.g Groups is accessed via: http://domain.com/groups/group-name NOT http://domain.com.andy/groups/group-name */
    12 define( 'BP_CORE_ROOT_COMPONENTS', 'groups,members' );
    1316
    1417/* Functions to handle pretty URLs and breaking them down into usable variables */
    … …  
    180183        $ud = get_userdata($user_id);
    181184       
    182         return $bp['root_domain'] . '/members/' . $ud->user_login . '/';
     185        return $bp['root_domain'] . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
    183186}
    184187
    … …  
    414417        $ud = get_userdata($uid);
    415418               
    416         return $bp['root_domain'] . '/members/' . $ud->user_login . '/';
     419        return $bp['root_domain'] . '/' . MEMBERS_SLUG . '/' . $ud->user_login . '/';
    417420}
    418421
  • trunk/bp-core/bp-core-ajax.php

    r432 r436  
    6969                foreach ( (array) $users as $user ) {
    7070                ?>
     71                        <?php $user_obj = new BP_Core_User( $user->user_id, true ); ?>
    7172                        <li>
    7273                                <div class="item-avatar">
    73                                         <?php echo bp_core_get_avatar( $user->user_id, 1 ) ?>
     74                                        <?php echo $user_obj->avatar_thumb ?>
    7475                                </div>
    7576
    7677                                <div class="item">
    77                                         <div class="item-title"><?php echo bp_core_get_userlink( $user->user_id ) ?></div>
    78                                         <div class="item-meta">
    79                                                 <span class="activity">
    80                                                         <?php echo bp_core_get_last_activity( get_usermeta( $user->user_id, 'last_activity' ), __('active '), __(' ago') ); ?>
    81                                                 </span>
     78                                        <div class="item-title"><?php echo $user_obj->user_link ?></div>
     79                                        <div class="item-meta"><span class="activity"><?php echo $user_obj->last_active ?></span></div>
     80                                </div>
     81                               
     82                                <div class="action">
     83                                        <?php bp_add_friend_button( $user_obj->id ) ?>
     84                                        <div class="meta">
     85                                                <?php if ( $user_obj->total_friends ) echo $user_obj->total_friends ?><?php if ( $user_obj->total_blogs ) echo ', ' . $user_obj->total_blogs ?><?php if ( $user_obj->total_groups ) echo ', ' . $user_obj->total_groups ?>
    8286                                        </div>
    8387                                </div>
     88                               
     89                                <div class="clear"></div>
    8490                        </li>
    8591                        <?php   
  • trunk/bp-core/bp-core-avatars.php

    r432 r436  
    195195
    196196function bp_core_check_avatar_upload($file) {
    197         if ( !isset($file['file']) || $file['file']['size'] == 0 )
     197        if ( $file['error'] )
    198198                return false;
    199199       
    … …  
    446446
    447447function bp_core_ap_die( $msg ) {
     448        global $bp;
    448449        echo '<p><strong>' . $msg . '</strong></p>';
    449         echo '<p><a href="' . $bp['loggedin_domain'] . '/' . $bp['profile']['slug'] . '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>';
     450        echo '<p><a href="' . site_url() . '/' . $bp['profile']['slug'] . '/change-avatar">' . __('Try Again', 'buddypress') . '</a></p>';
    450451        echo '</div>';
    451452        exit;
  • trunk/bp-core/bp-core-catchuri.php

    r431 r436  
    7272        $bp_uri = array_merge( array(), $bp_uri );     
    7373
    74         if ( $bp_uri[0] == 'members' && $bp_uri[1] != '' ) {
     74        if ( $bp_uri[0] == MEMBERS_SLUG && $bp_uri[1] != '' ) {
    7575                $is_member_page = true;
    7676                $is_root_component = true;
  • trunk/bp-core/bp-core-classes.php

    r430 r436  
    8080       
    8181        function populate_extras() {
     82                global $bp;
     83               
    8284                $this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
    8385
    … …  
    8789                        else
    8890                                $this->total_friends .= ' ' . __( 'friends', 'buddypress' );
     91                       
     92                        $this->total_friends = '<a href="' . $this->user_url . $bp['friends']['slug'] . '" title="' . sprintf( __( "%s's friend list", 'buddypress' ), $this->fullname ) . '">' . $this->total_friends . '</a>';
    8993                }
    9094               
    … …  
    9498                        else
    9599                                $this->total_blogs .= ' ' . __( 'blogs', 'buddypress' );                       
     100                               
     101                        $this->total_blogs = '<a href="' . $this->user_url . $bp['blogs']['slug'] . '" title="' . sprintf( __( "%s's blog list", 'buddypress' ), $this->fullname ) . '">' . $this->total_blogs . '</a>';
    96102                }
    97103       
    … …  
    104110                                else
    105111                                        $this->total_groups .= ' ' . __( 'groups', 'buddypress' );
     112
     113                                $this->total_groups = '<a href="' . $this->user_url . $bp['groups']['slug'] . '" title="' . sprintf( __( "%s's group list", 'buddypress' ), $this->fullname ) . '">' . $this->total_groups . '</a>';
    106114                        }
    107115                }
  • trunk/bp-core/bp-core-cssjs.php

    r394 r436  
    4343                wp_enqueue_style( 'bp-admin-bar', site_url() . '/wp-content/mu-plugins/bp-core/css/admin-bar.css' );
    4444        }
     45       
     46        /* If you want custom css styles, include a custom-styles.css file in /bp-core/css/custom-styles.css */
     47        if ( file_exists(ABSPATH . MUPLUGINDIR . '/bp-core/css/custom-styles.css') )
     48                wp_enqueue_style( 'bp-core-custom-styles', site_url() . MUPLUGINDIR . '/bp-core/css/custom-styles.css' );               
     49       
    4550        wp_print_styles();
    4651}
  • trunk/bp-core/bp-core-widgets.php

    r394 r436  
    101101                <div class="item-options" id="members-list-options">
    102102                        <img id="ajax-loader-members" src="<?php echo $bp['core']['image_base'] ?>/ajax-loader.gif" height="7" alt="Loading" style="display: none;" /> &nbsp;
    103                         <a href="<?php echo site_url() . '/members' ?>" id="newest-members" class="selected"><?php _e("Newest", 'buddypress') ?></a> |
    104                         <a href="<?php echo site_url() . '/members' ?>" id="recently-active-members"><?php _e("Active", 'buddypress') ?></a> |
    105                         <a href="<?php echo site_url() . '/members' ?>" id="popular-members"><?php _e("Popular", 'buddypress') ?></a>
     103                        <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="newest-members" class="selected"><?php _e("Newest", 'buddypress') ?></a> |
     104                        <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="recently-active-members"><?php _e("Active", 'buddypress') ?></a> |
     105                        <a href="<?php echo site_url() . '/' . MEMBERS_SLUG ?>" id="popular-members"><?php _e("Popular", 'buddypress') ?></a>
    106106                </div>
    107107                <ul id="members-list" class="item-list">
  • trunk/bp-core/css/directory-members.css

    r394 r436  
    66        ul#letter-list li {
    77                float: left;
    8                 margin: 0 14px 14px 0;
     8                margin: 0 4px 3px 0;
    99        }
    1010                ul#letter-list li a {
    1111                        display: block;
    1212                        background: #eee;
    13                         padding: 5px;
    14                         width: 22px;
     13                        width: 20px;
    1514                        text-align: center;
    1615                        text-decoration: none;
    … …  
    2423                        color: #f7740a;
    2524                }
     25
     26ul#members-list li {
     27        position: relative;
     28}
    2629
    2730        ul#members-list li .item-avatar, .avatar-block img.avatar {
    … …  
    5154                margin: -15px 0 5px 0;
    5255        }
     56       
     57        ul#members-list li div.action {
     58                position: absolute;
     59                top: 20%;
     60                right: 1em;
     61                text-align: right;
     62        }
     63                div.action div.friendship-button {
     64                        margin-bottom: 5px;
     65                }
     66               
     67                div.action div.meta {
     68                        font-size: 0.9em;
     69                }
     70       
     71        ul#members-list li a.add, ul#members-list li a.remove, ul#members-list li div.pending {
     72                background: url(../images/add_friend_button.gif) top left no-repeat;
     73                text-indent: -999em;
     74                display: block;
     75                overflow: hidden;
     76                width: 102px;
     77                text-align: left;
     78        }
     79       
     80        ul#members-list li a.remove {
     81                background: url(../images/remove_friend_button.gif) top left no-repeat;
     82                width: 121px;
     83        }
     84
     85        ul#members-list li div.pending {
     86                background: url(../images/requested_friend_button.gif) top left no-repeat;
     87                width: 136px;
     88        }
     89       
     90       
     91       
     92       
  • trunk/bp-core/directories/bp-core-directory-members.php

    r431 r436  
    33        global $bp, $current_blog;
    44       
    5         if ( $bp['current_component'] == 'members' && $bp['current_action'] == '' ) {
     5        if ( $bp['current_component'] == MEMBERS_SLUG && $bp['current_action'] == '' ) {
    66                add_action( 'bp_template_content', 'bp_core_directory_members_content' );
    77                add_action( 'bp_template_sidebar', 'bp_core_directory_members_sidebar' );
    … …  
    7979                                        <div class="action">
    8080                                                <?php bp_add_friend_button( $user_obj->id ) ?>
    81                                                 <?php if ( $user_obj->total_friends ) echo $user_obj->total_friends ?>
    82                                                 <?php if ( $user_obj->total_blogs ) echo $user_obj->total_blogs ?>
    83                                                 <?php if ( $user_obj->total_groups ) echo $user_obj->total_groups ?>
     81                                                <div class="meta">
     82                                                        <?php if ( $user_obj->total_friends ) echo $user_obj->total_friends ?><?php if ( $user_obj->total_blogs ) echo ', ' . $user_obj->total_blogs ?><?php if ( $user_obj->total_groups ) echo ', ' . $user_obj->total_groups ?>
     83                                                </div>
    8484                                        </div>
    8585                                       
    … …  
    9090                <?php endif; ?>
    9191        </div>
    92         <?php wp_nonce_field('directory_members') ?>
     92        <?php wp_nonce_field('directory_members', '_wpnonce-member-filter' ) ?>
    9393        </form>
    94        
    95        
    9694<?php
    9795}
    … …  
    102100        <div class="widget">
    103101                <h2 class="widgettitle"><?php _e('Search Members') ?></h2>
    104                 <form action="<?php echo site_url() . '/members/search/' ?>" method="post" id="search-members-form">
     102                <form action="<?php echo site_url() . '/' . MEMBERS_SLUG  . '/search/' ?>" method="post" id="search-members-form">
    105103                        <label><input type="text" name="members_search" id="members_search" value="" /></label>
    106104                        <input type="submit" id="members_search_submit" name="members_search_submit" value="Search" />
  • trunk/bp-core/js/directory-members.js

    r394 r436  
    1313                                action: 'directory_members',
    1414                                'cookie': encodeURIComponent(document.cookie),
    15                                 '_wpnonce': jQuery("input#_wpnonce").val(),
     15                                '_wpnonce': jQuery("input#_wpnonce-member-filter").val(),
    1616                                'letter': letter[1],
    1717                        },
  • trunk/bp-core/js/general.js

    r309 r436  
    22        jQuery("div.friendship-button a").livequery('click',
    33                function(e) {
    4                         jQuery(this).toggle();
    5                         jQuery(this).before('<span id="working">Working...</span>');
    6                
    74                        var fid = jQuery(this).attr('id');
    85                        fid = fid.split('-');
    … …  
    2118                       
    2219                                var action = thelink.attr('rel');
    23                        
     20                                var parentdiv = thelink.parent();
     21                               
    2422                                if ( action == 'add' ) {
    25                                         jQuery("#working").html(response);
    26                                 } else {
    27                                         jQuery("#working").toggle();
    28                                         thelink.html(response);
    29                                         thelink.attr('rel', 'add');
    30                                         thelink.removeClass('remove');
    31                                         thelink.toggle();
     23                                        jQuery(parentdiv).fadeOut(200,
     24                                                function() {
     25                                                        parentdiv.removeClass('add_friend');
     26                                                        parentdiv.addClass('pending');
     27                                                        parentdiv.fadeIn(200).html(response);
     28                                                }
     29                                        );
     30
     31                                } else if ( action == 'remove' ) {
     32                                        jQuery(parentdiv).fadeOut(200,
     33                                                function() {
     34                                                        parentdiv.removeClass('remove_friend');
     35                                                        parentdiv.addClass('add');
     36                                                        parentdiv.fadeIn(200).html(response);
     37                                                }
     38                                        );                             
    3239                                }
    33 
    3440                        });
    3541                        return false;
  • trunk/bp-friends/bp-friends-ajax.php

    r431 r436  
    112112
    113113        if ( BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $_POST['fid'] ) == 'is_friend' ) {
    114                 if ( !friends_remove_friend( $bp['loggedin_userid'], $bp['current_userid'] ) ) {
     114                if ( !friends_remove_friend( $bp['loggedin_userid'], $_POST['fid'] ) ) {
    115115                        echo __("Friendship could not be canceled.", 'buddypress');
    116116                } else {
    117                         friends_update_friend_totals( $bp['loggedin_userid'], $bp['current_userid'], 'remove' );
    118                         echo __('Add Friend', 'buddypress');
     117                        friends_update_friend_totals( $bp['loggedin_userid'], $_POST['fid'], 'remove' );
     118                        echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $_POST['fid'] . '">' . __( 'Add Friend', 'buddypress' ) . '</a>';
    119119                }
    120120        } else if ( BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $_POST['fid'] ) == 'not_friends' ) {
    … …  
    122122                        echo __("Friendship could not be requested.", 'buddypress');
    123123                } else {
    124                         echo __('Friendship Requested', 'buddypress');
     124                        echo 'Friendship Requested';
     125                        //echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Remove Friend', 'buddypress' ) . '" href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $_POST['fid'] . '">' . __( 'Remove Friend', 'buddypress' ) . '</a>';
    125126                }
    126127        } else {
  • trunk/bp-friends/bp-friends-templatetags.php

    r396 r436  
    324324                $friend_status = BP_Friends_Friendship::check_is_friend( $bp['loggedin_userid'], $potential_friend_id );
    325325       
    326                 echo '<div class="friendship-button" id="friendship-button-' . $potential_friend_id . '">';
     326                echo '<div class="friendship-button ' . $friend_status . '" id="friendship-button-' . $potential_friend_id . '">';
    327327                if ( $friend_status == 'pending' ) {
    328328                        _e('Friendship Requested', 'buddypress');
    … …  
    330330                        echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/remove-friend/' . $potential_friend_id . '" title="' . __('Cancel Friendship', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="remove" class="remove">' . __('Cancel Friendship', 'buddypress') . '</a>';
    331331                } else {
    332                         echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add">' . __('Add Friend', 'buddypress') . '</a>';
     332                        echo '<a href="' . $bp['loggedin_domain'] . $bp['friends']['slug'] . '/add-friend/' . $potential_friend_id . '" title="' . __('Add Friend', 'buddypress') . '" id="friend-' . $potential_friend_id . '" rel="add" class="add">' . __('Add Friend', 'buddypress') . '</a>';
    333333                }
    334334                echo '</div>';
  • trunk/bp-groups/bp-groups-templatetags.php

    r396 r436  
    255255function bp_group_all_members_permalink() {
    256256        global $groups_template, $bp;
    257         echo bp_group_permalink( false, true ) . '/members';
     257        echo bp_group_permalink( false, true ) . '/' . MEMBERS_SLUG ;
    258258}
    259259
    … …  
    600600                <?php } else { ?>
    601601                        <div id="message" class="info">
    602                                 <p><?php bp_word_or_name( __( "You haven't oined any groups yet.", 'buddypress' ), __( "%s hasn't joined any groups yet.", 'buddypress' ) ) ?></p>
     602                                <p><?php bp_word_or_name( __( "You haven't joined any groups yet.", 'buddypress' ), __( "%s hasn't joined any groups yet.", 'buddypress' ) ) ?></p>
    603603                        </div>
    604604                <?php } ?>
  • trunk/bp-wire/bp-wire-templatetags.php

    r431 r436  
    213213       
    214214        if ( $bp['current_component'] == 'wire' || $bp['current_component'] == 'profile' ) {
    215                 echo site_url() . '/' . $bp['wire']['slug'] . '/post/';
     215                echo $bp['current_domain'] . $bp['wire']['slug'] . '/post/';
    216216        } else {
    217                 echo site_url() . '/' . $bp[$bp['current_component']]['slug'] . '/' . $uri . '/wire/post/';
     217                echo $bp['current_domain'] . $bp[$bp['current_component']]['slug'] . '/' . $uri . '/wire/post/';
    218218        }
    219219}
  • trunk/bp-xprofile/bp-xprofile-signup.php

    r432 r436  
    152152                2 => __("Your image was bigger than the maximum allowed file size of: ", 'buddypress') . size_format(CORE_MAX_FILE_SIZE),
    153153                3 => __("The uploaded file was only partially uploaded", 'buddypress'),
    154                 4 => __("No file was uploaded", 'buddypress'),
    155154                6 => __("Missing a temporary folder", 'buddypress')
    156155        );
    157156
    158         if ( !$checked_upload = bp_core_check_avatar_upload($_FILES) ) {
    159                 $avatar_error = true;
    160                 $avatar_error_msg = $uploadErrors[$_FILES['file']['error']];
    161         }
    162 
    163         if ( $checked_upload && !$checked_size = bp_core_check_avatar_size($_FILES) ) {
    164                 $avatar_error = true;
    165                 $avatar_size = size_format(CORE_MAX_FILE_SIZE);
    166                 $avatar_error_msg = sprintf( __('The file you uploaded is too big. Please upload a file under %s', 'buddypress'), $avatar_size);
    167         }
    168 
    169         if ( $checked_upload && $checked_size && !$checked_type = bp_core_check_avatar_type($_FILES) ) {
    170                 $avatar_error = true;
    171                 $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.', 'buddypress');             
    172         }
    173 
    174         // "Handle" upload into temporary location
    175         if ( $checked_upload && $checked_size && $checked_type && !$original = bp_core_handle_avatar_upload($_FILES) ) {
    176                 $avatar_error = true;
    177                 $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.', 'buddypress');                                               
    178         }
    179 
    180         if ( $checked_upload && $checked_size && $checked_type && $original && !$checked_dims = bp_core_check_avatar_dimensions($original) ) {
    181                 $avatar_error = true;
    182                 $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.', 'buddypress'), CORE_AVATAR_V2_W, CORE_AVATAR_V2_W );
    183         }
    184        
    185         if ( $checked_upload && $checked_size && $checked_type && $original && $checked_dims && !$canvas = bp_core_resize_avatar($original) )
    186                 $canvas = $original;
    187 
     157        if ( $_FILES['file']['error'] !== 4 ) {
     158                if ( !$checked_upload = bp_core_check_avatar_upload($_FILES) ) {
     159                        $avatar_error = true;
     160                        $avatar_error_msg = $uploadErrors[$_FILES['file']['error']];
     161                }
     162
     163                if ( $checked_upload && !$checked_size = bp_core_check_avatar_size($_FILES) ) {
     164                        $avatar_error = true;
     165                        $avatar_size = size_format(CORE_MAX_FILE_SIZE);
     166                        $avatar_error_msg = sprintf( __('The file you uploaded is too big. Please upload a file under %s', 'buddypress'), $avatar_size);
     167                }
     168
     169                if ( $checked_upload && $checked_size && !$checked_type = bp_core_check_avatar_type($_FILES) ) {
     170                        $avatar_error = true;
     171                        $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.', 'buddypress');             
     172                }
     173
     174                // "Handle" upload into temporary location
     175                if ( $checked_upload && $checked_size && $checked_type && !$original = bp_core_handle_avatar_upload($_FILES) ) {
     176                        $avatar_error = true;
     177                        $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.', 'buddypress');                                               
     178                }
     179
     180                if ( $checked_upload && $checked_size && $checked_type && $original && !$checked_dims = bp_core_check_avatar_dimensions($original) ) {
     181                        $avatar_error = true;
     182                        $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.', 'buddypress'), CORE_AVATAR_V2_W, CORE_AVATAR_V2_W );
     183                }
     184       
     185                if ( $checked_upload && $checked_size && $checked_type && $original && $checked_dims && !$canvas = bp_core_resize_avatar($original) )
     186                        $canvas = $original;
     187        }
     188       
    188189        if ( !$has_errors && !$avatar_error ) {
    189190                $public = (int) $_POST['blog_public'];
Note: See TracChangeset for help on using the changeset viewer.