Skip to:
Content

BuddyPress.org

Changeset 2075


Ignore:
Timestamp:
11/02/2009 06:26:55 PM (16 years ago)
Author:
apeatling
Message:

Applying jjj trunk fixes to 1.1 branch.

Location:
branches/1.1
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1/bp-activity/bp-activity-templatetags.php

    r2052 r2075  
    238238        $object = apply_filters( 'bp_get_activity_avatar_object_' . $activities_template->activity->component_name, $object );
    239239       
    240         return apply_filters( 'bp_get_group_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height ) ) );
     240        return apply_filters( 'bp_get_activity_avatar', bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height ) ) );
    241241    }
    242242
  • branches/1.1/bp-core/bp-core-avatars.php

    r2025 r2075  
    9393    $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) . '/' . basename( WP_CONTENT_DIR ) . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
    9494    $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );   
    95    
     95
     96    /****
     97     * Look for uploaded avatar first. Use it if it exists.
     98     * Set the file names to search for, to select the full size
     99     * or thumbnail image.
     100     */
     101    $avatar_name = ( 'full' == $type ) ? '-bpfull' : '-bpthumb';
     102    $legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1';
     103    $legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb';
     104
     105    if ( file_exists( $avatar_folder_dir ) ) {
     106        if ( $av_dir = opendir( $avatar_folder_dir ) ) {
     107            while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
     108                if ( preg_match( "/{$avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_user_avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_group_avatar_name}/", $avatar_file ) )
     109                    $avatar_url = $avatar_folder_url . '/' . $avatar_file;
     110            }
     111        }
     112        closedir($av_dir);
     113
     114        if ( $avatar_url )
     115            return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params );
     116    }
     117
    96118    /* If no avatars have been uploaded for this item, display a gravatar */   
    97     if ( !file_exists( $avatar_folder_dir ) && !$no_grav ) {
     119    if ( !file_exists( $avatar_url ) && !$no_grav ) {
    98120       
    99121        if ( empty( $bp->grav_default->{$object} ) )
     
    120142        return apply_filters( 'bp_core_fetch_avatar', "<img src='{$gravatar}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params );
    121143   
    122     } else if ( !file_exists( $avatar_folder_dir ) && $no_grav )
    123         return false;
    124    
    125     /* Set the file names to search for to select the full size or thumbnail image. */
    126     $avatar_name = ( 'full' == $type ) ? '-bpfull' : '-bpthumb';   
    127     $legacy_user_avatar_name = ( 'full' == $type ) ? '-avatar2' : '-avatar1';   
    128     $legacy_group_avatar_name = ( 'full' == $type ) ? '-groupavatar-full' : '-groupavatar-thumb';   
    129    
    130     if ( $av_dir = opendir( $avatar_folder_dir ) ) {
    131         while ( false !== ( $avatar_file = readdir($av_dir) ) ) {
    132             if ( preg_match( "/{$avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_user_avatar_name}/", $avatar_file ) || preg_match( "/{$legacy_group_avatar_name}/", $avatar_file ) )
    133                 $avatar_url = $avatar_folder_url . '/' . $avatar_file;
    134         }
    135     }
    136     closedir($av_dir);
    137 
    138     return apply_filters( 'bp_core_fetch_avatar', "<img src='{$avatar_url}' alt='{$alt}' id='{$css_id}' class='{$class}'{$html_width}{$html_height} />", $params );
     144    } else if ( !file_exists( $avatar_url ) && $no_grav )
     145        return false;
     146   
    139147}
    140148
  • branches/1.1/bp-core/bp-core-signup.php

    r2045 r2075  
    173173
    174174        if ( !bp_core_avatar_handle_crop( array( 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
    175             bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ) );
     175            bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' );
    176176        else
    177177            bp_core_add_message( __( 'Your new avatar was uploaded successfully', 'buddypress' ) );
     
    209209        return false;
    210210
    211     if ( '' != locate_template( array( 'registration/register.php' ), false ) || '' != locate_template( array( 'register.php' ), false ) )
    212         die;
     211    if ( locate_template( array( 'registration/register.php' ), false ) || locate_template( array( 'register.php' ), false ) )
     212        wp_redirect( bp_root_domain() . BP_REGISTER_SLUG );
    213213}
    214214add_action( 'signup_header', 'bp_core_wpsignup_redirect' );
    215 
    216 
    217 
    218 
    219215?>
  • branches/1.1/bp-core/bp-core-templatetags.php

    r2007 r2075  
    14671467}
    14681468
     1469function bp_is_group_single() {
     1470    global $bp;
     1471
     1472    if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item )
     1473        return true;
     1474
     1475    return false;
     1476}
     1477
    14691478function bp_is_user_blogs() {
    14701479    global $bp;
  • branches/1.1/bp-core/deprecated/bp-core-deprecated.php

    r2032 r2075  
    750750
    751751/***
    752  * In older versions of BuddyPress, BuddyPress templates were in a seperate theme.
     752 * In older versions of BuddyPress, BuddyPress templates were in a separate theme.
    753753 * The child theme setup makes upgrades and extending themes much easier, so the
    754754 * old method was deprecated.
  • branches/1.1/bp-groups.php

    r2032 r2075  
    545545    }
    546546   
    547     /* Group avatar is handled seperately */
     547    /* Group avatar is handled separately */
    548548    if ( 'group-avatar' == $bp->groups->current_create_step && isset( $_POST['upload'] ) ) {
    549549        if ( !empty( $_FILES ) && isset( $_POST['upload'] ) ) {
     
    11541154        if ( 'demote' == $bp->action_variables[1] && is_numeric( $bp->action_variables[2] ) ) {
    11551155            $user_id = $bp->action_variables[2];
     1156           
     1157            /* Check if the user is the group admin first. */
     1158            if ( groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     1159                    bp_core_add_message(  __('As the only group administrator, you cannot demote yourself.', 'buddypress'), 'error' );
     1160                    bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     1161            }       
    11561162
    11571163            /* Check the nonce first. */
     
    11741180            $user_id = $bp->action_variables[2];
    11751181
     1182            /* Check if the user is the group admin first. */
     1183            if ( groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
     1184                    bp_core_add_message(  __('As the only group administrator, you cannot ban yourself.', 'buddypress'), 'error' );
     1185                    bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );
     1186            }
     1187           
    11761188            /* Check the nonce first. */
    11771189            if ( !check_admin_referer( 'groups_ban_member' ) )
  • branches/1.1/bp-xprofile/bp-xprofile-admin.php

    r1969 r2075  
    9090                                    <tr id="field_<?php echo attribute_escape( $field->id ); ?>" class="sortable<?php if ( $class ) { echo ' ' . $class; } ?>">
    9191                                        <td width="10"><img src="<?php echo BP_PLUGIN_URL ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' ) ?>" /></td>
    92                                         <td><span title="<?php echo $field->desc; ?>"><?php echo attribute_escape( $field->name ); ?> <?php if(!$field->can_delete) { ?> <?php _e( '(Core Field)', 'buddypress' ) ?><?php } ?></span></td>
     92                                        <td><span title="<?php echo $field->description; ?>"><?php echo attribute_escape( $field->name ); ?> <?php if(!$field->can_delete) { ?> <?php _e( '(Core Field)', 'buddypress' ) ?><?php } ?></span></td>
    9393                                        <td><?php echo attribute_escape( $field->type ); ?></td>
    9494                                        <td style="text-align:center;"><?php if ( $field->is_required ) { echo '<img src="' . BP_PLUGIN_URL . '/bp-xprofile/admin/images/tick.gif" alt="' . __( 'Yes', 'buddypress' ) . '" />'; } else { ?>--<?php } ?></td>
     
    217217        if ( BP_XProfile_Field::admin_validate() ) {
    218218            $field->name = wp_filter_kses( $_POST['title'] );
    219             $field->desc = wp_filter_kses( $_POST['description'] );
     219            $field->description = wp_filter_kses( $_POST['description'] );
    220220            $field->is_required = wp_filter_kses( $_POST['required'] );
    221221            $field->type = wp_filter_kses( $_POST['fieldtype'] );
  • branches/1.1/bp-xprofile/bp-xprofile-classes.php

    r2025 r2075  
    182182    var $type;
    183183    var $name;
    184     var $desc;
     184    var $description;
    185185    var $is_required;
    186186    var $can_delete;
     
    215215            $this->type = $field->type;
    216216            $this->name = stripslashes($field->name);
    217             $this->desc = stripslashes($field->description);
     217            $this->description = stripslashes($field->description);
    218218            $this->is_required = $field->is_required;
    219219            $this->can_delete = $field->can_delete;
     
    257257        $this->type = apply_filters( 'xprofile_field_type_before_save', $this->type, $this->id );
    258258        $this->name = apply_filters( 'xprofile_field_name_before_save', $this->name, $this->id );
    259         $this->desc = apply_filters( 'xprofile_field_description_before_save', $this->desc, $this->id );
     259        $this->description = apply_filters( 'xprofile_field_description_before_save', $this->description, $this->id );
    260260        $this->is_required = apply_filters( 'xprofile_field_is_required_before_save', $this->is_required, $this->id );
    261261        $this->order_by = apply_filters( 'xprofile_field_order_by_before_save', $this->order_by, $this->id );
     
    265265       
    266266        if ( $this->id != null )
    267             $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->order_by, $this->field_order, $this->id);
     267            $sql = $wpdb->prepare("UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->id);
    268268        else
    269             $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, 0, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->type, $this->name, $this->desc, $this->is_required, $this->order_by, $this->field_order );
     269            $sql = $wpdb->prepare("INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, 0, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order );
    270270
    271271        // Check for null so field options can be changed without changing any other part of the field.
     
    520520
    521521            $this->name         = $_POST['title'];
    522             $this->desc         = $_POST['description'];
     522            $this->description  = $_POST['description'];
    523523            $this->is_required  = $_POST['required'];
    524524            $this->type         = $_POST['fieldtype'];
     
    555555                    <h3><label for="description"><?php _e("Field Description", 'buddypress') ?></label></h3>
    556556                    <div id="titlewrap">
    557                         <textarea name="description" id="description" rows="8" cols="60"><?php echo htmlspecialchars( $this->desc ); ?></textarea>
     557                        <textarea name="description" id="description" rows="8" cols="60"><?php echo htmlspecialchars( $this->description ); ?></textarea>
    558558                    </div>
    559559                </div>
  • branches/1.1/bp-xprofile/bp-xprofile-templatetags.php

    r2056 r2075  
    369369        global $field;
    370370       
    371         return apply_filters( 'bp_get_the_profile_field_description', $field->desc );
     371        return apply_filters( 'bp_get_the_profile_field_description', $field->description );
    372372    }
    373373   
Note: See TracChangeset for help on using the changeset viewer.