Skip to:
Content

BuddyPress.org

Changeset 1714


Ignore:
Timestamp:
08/27/2009 05:43:08 PM (17 years ago)
Author:
apeatling
Message:

Signup avatar upload fixes and DB fixes.

Location:
trunk
Files:
6 edited

Legend:

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

    r1712 r1714  
    200200       
    201201        $bp->avatar_admin->original = wp_handle_upload( $file['file'], array( 'action'=> 'bp_avatar_upload' ) );
    202        
     202
    203203        // Move the file to the correct upload location.
    204204        if ( !empty( $bp->avatar_admin->original['error'] ) ) {
  • trunk/bp-core/bp-core-catchuri.php

    r1677 r1714  
    101101        $bp_uri = array_merge( array(), $bp_uri );
    102102        $bp_unfiltered_uri = $bp_uri;
    103        
     103
    104104        /* Catch a member page and set the current member ID */
    105105        if ( $bp_uri[0] == BP_MEMBERS_SLUG || in_array( 'wp-load.php', $bp_uri ) ) {
    106106                $is_member_page = true;
    107107                $is_root_component = true;
    108                
     108
    109109                // We are within a member page, set up user id globals
    110110                $displayed_user_id = bp_core_get_displayed_userid( $bp_uri[1] );
    … …  
    175175
    176176        $bp_path = $pages;
    177 
     177       
    178178        if ( !bp_is_blog_page() ) {
    179179                remove_action( 'template_redirect', 'redirect_canonical' );
    … …  
    245245        }
    246246}
    247 add_action( 'wp', 'bp_core_catch_no_access', 10 );
     247add_action( 'wp', 'bp_core_catch_no_access' );
    248248
    249249/**
  • trunk/bp-core/bp-core-signup.php

    r1682 r1714  
    138138
    139139        $bp->avatar_admin->step = 'upload-image';
    140        
     140
    141141        /* If user has uploaded a new avatar */
    142142        if ( !empty( $_FILES ) ) {
    … …  
    144144                /* Check the nonce */
    145145                check_admin_referer( 'bp_avatar_upload' );
     146
     147                $bp->signup->step = 'completed-confirmation';
    146148               
    147149                /* Get the activation key */
    … …  
    152154                        $bp->signup->avatar_dir = wp_hash( $bp->signup->key );
    153155                       
    154                         /* Pass the file to the avatar upload handler */
    155                         $errors = bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' );
    156 
    157                         if ( !$errors ) {
    158                                 $bp->signup->step = 'completed-confirmation';
     156                        /* Pass the file to the avatar upload handler */               
     157                        if ( bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' ) ) {           
    159158                                $bp->avatar_admin->step = 'crop-image';
    160159
    161160                                /* Make sure we include the jQuery jCrop file for image cropping */
    162161                                add_action( 'wp', 'bp_core_add_jquery_cropper' );
    163                         }
     162                        }                       
    164163                }
    165164        }
    … …  
    191190                return false;
    192191       
    193         $path  = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
     192        $path = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
    194193        $newdir = path_join( ABSPATH, $path );
    195194        $newdir .= '/avatars/signups/' . $bp->signup->avatar_dir;
  • trunk/bp-core/bp-core-templatetags.php

    r1655 r1714  
    828828                $signup_avatar_dir = ( !empty( $_POST['signup_avatar_dir'] ) ) ? $_POST['signup_avatar_dir'] : $bp->signup->avatar_dir;
    829829
    830                 if ( empty( $signup_avatar_dir) ) {
    831                         if ( empty( $bp->grav_default ) ) {
     830                if ( empty( $signup_avatar_dir ) ) {
     831                        if ( empty( $bp->grav_default->user ) ) {
    832832                                $default_grav = 'wavatar';
    833                         } else if ( 'mystery' == $bp->grav_default ) {
     833                        } else if ( 'mystery' == $bp->grav_default->user ) {
    834834                                $default_grav = BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg';
    835835                        } else {
    836                                 $default_grav = $bp->grav_default;
     836                                $default_grav = $bp->grav_default->user;
    837837                        }
    838838               
    839839                        $gravatar_url = apply_filters( 'bp_gravatar_url', 'http://www.gravatar.com/avatar/' );
    840                         return apply_filters( 'bp_get_signup_avatar', '<img src="' . $gravatar_url . md5( $_POST['signup_email'] ) . '?d=' . $default_grav . '&amp;s=' . $size ) . '" width="' . $size . ' height="' . $size . '" alt= "' . $alt . '" class="' . $class . '" />';
     840                        return apply_filters( 'bp_get_signup_avatar', '<img src="' . $gravatar_url . md5( $_POST['signup_email'] ) . '?d=' . $default_grav . '&amp;s=' . $size ) . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class . '" />';
    841841                } else {
    842842                        return apply_filters( 'bp_get_signup_avatar', bp_core_fetch_avatar( array( 'item_id' => $signup_avatar_dir, 'object' => 'signup', 'avatar_dir' => 'avatars/signups', 'type' => 'full', 'width' => $size, 'height' => $size, 'alt' => $alt, 'class' => $class ) ) );
  • trunk/bp-groups.php

    r1710 r1714  
    11<?php
    22
    3 define ( 'BP_GROUPS_DB_VERSION', '1710' );
     3define ( 'BP_GROUPS_DB_VERSION', '1711' );
    44
    55/* Define the slug for the component */
    … …  
    3232                        enable_wire tinyint(1) NOT NULL DEFAULT '1',
    3333                        enable_forum tinyint(1) NOT NULL DEFAULT '1',
    34                         date_created datetime NOT NULL
     34                        date_created datetime NOT NULL,
    3535                    KEY creator_id (creator_id),
    3636                    KEY status (status)
    … …  
    533533                                add_action( 'wp', 'bp_core_add_jquery_cropper' );
    534534                        }
    535                         //var_dump($_COOKIE);
    536535                }
    537536
  • trunk/bp-xprofile.php

    r1693 r1714  
    11<?php
    2 define ( 'BP_XPROFILE_DB_VERSION', '1700' );
     2define ( 'BP_XPROFILE_DB_VERSION', '1705' );
    33
    44/* Define the slug for the component */
    … …  
    8484       
    8585                $sql[] = "INSERT INTO {$bp->profile->table_name_fields} (
    86                                         id, group_id, parent_id, type, name, description, is_required, field_order, option_order, order_by, is_public, can_delete
     86                                        id, group_id, parent_id, type, name, is_required, can_delete
    8787                                  ) VALUES (
    88                                         1, 1, 0, 'textbox', '" . get_site_option( 'bp-xprofile-fullname-field-name' ) . "', '', 1, 1, 0, '', 1, 0
     88                                        1, 1, 0, 'textbox', '" . get_site_option( 'bp-xprofile-fullname-field-name' ) . "', 1, 0
    8989                                  );";
    9090        }
    … …  
    106106
    107107        $sql[] = "CREATE TABLE {$bp->profile->table_name_wire} (
    108                            id bigint(20) NOT NULL AUTO_INCREMENT,
     108                           id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    109109                           item_id bigint(20) NOT NULL,
    110110                           user_id bigint(20) NOT NULL,
    111111                           content longtext NOT NULL,
    112112                           date_posted datetime NOT NULL,
    113                            PRIMARY KEY id (id),
    114113                           KEY item_id (item_id),
    115114                       KEY user_id (user_id)
    … …  
    372371
    373372                if ( !bp_core_avatar_handle_crop( array( 'item_id' => $bp->displayed_user->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
    374                         bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ) );
     373                        bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' );
    375374                else
    376375                        bp_core_add_message( __( 'Your new avatar was uploaded successfully!', 'buddypress' ) );
Note: See TracChangeset for help on using the changeset viewer.