Changeset 373 for trunk/bp-groups.php
- Timestamp:
- 10/07/2008 07:16:51 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/bp-groups.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups.php
r359 r373 3 3 4 4 define ( 'BP_GROUPS_IS_INSTALLED', 1 ); 5 define ( 'BP_GROUPS_VERSION', '0.1. 5' );5 define ( 'BP_GROUPS_VERSION', '0.1.6' ); 6 6 7 7 include_once( 'bp-groups/bp-groups-classes.php' ); 8 8 include_once( 'bp-groups/bp-groups-ajax.php' ); 9 9 include_once( 'bp-groups/bp-groups-cssjs.php' ); 10 include_once( 'bp-groups/bp-groups-templatetags.php' ); 11 include_once( 'bp-groups/bp-groups-widgets.php' ); 10 12 /*include_once( 'bp-messages/bp-groups-admin.php' );*/ 11 include_once( 'bp-groups/bp-groups-templatetags.php' );12 13 13 14 14 /************************************************************************** … … 92 92 'table_name' => $wpdb->base_prefix . 'bp_groups', 93 93 'table_name_members' => $wpdb->base_prefix . 'bp_groups_members', 94 'image_base' => get_option('siteurl') . '/wp-content/mu-plugins/bp-groups/images',94 'image_base' => site_url() . '/wp-content/mu-plugins/bp-groups/images', 95 95 'format_activity_function' => 'groups_format_activity', 96 96 'slug' => 'groups' … … 552 552 $avatar_error = false; 553 553 554 if ( bp_core_check_avatar_upload($file) ) { 555 if ( !bp_core_check_avatar_upload($file) ) { 556 $avatar_error = true; 557 $avatar_error_msg = __('Your group avatar upload failed, please try again.'); 558 } 559 560 if ( !bp_core_check_avatar_size($file) ) { 561 $avatar_error = true; 562 $avatar_size = size_format(1024 * CORE_MAX_FILE_SIZE); 563 $avatar_error_msg = sprintf( __('The file you uploaded is too big. Please upload a file under %d'), $avatar_size); 564 } 565 566 if ( !bp_core_check_avatar_type($file) ) { 567 $avatar_error = true; 568 $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.'); 569 } 570 571 // "Handle" upload into temporary location 572 if ( !$original = bp_core_handle_avatar_upload($file) ) { 573 $avatar_error = true; 574 $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.'); 575 } 576 577 if ( !bp_core_check_avatar_dimensions($original) ) { 578 $avatar_error = true; 579 $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.'), CORE_CROPPING_CANVAS_MAX, CORE_CROPPING_CANVAS_MAX ); 580 } 581 582 if ( !$canvas = bp_core_resize_avatar($original) ) { 583 $avatar_error = true; 584 $avatar_error_msg = __('Could not create thumbnail, try another photo.'); 585 } 586 587 if ( $avatar_error ) { ?> 588 <div id="message" class="error"> 589 <p><?php echo $avatar_error_msg ?></p> 590 </div> 591 <?php 592 bp_core_render_avatar_upload_form( '', true ); 593 } else { 594 bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp['loggedin_domain'] ); 595 } 554 // Set friendly error feedback. 555 $uploadErrors = array( 556 0 => __("There is no error, the file uploaded with success"), 557 1 => __("The uploaded file exceeds the upload_max_filesize directive in php.ini"), 558 2 => __("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), 559 3 => __("The uploaded file was only partially uploaded"), 560 4 => __("No file was uploaded"), 561 6 => __("Missing a temporary folder") 562 ); 563 564 if ( !bp_core_check_avatar_upload($file) ) { 565 $avatar_error = true; 566 $avatar_error_msg = __('Your group avatar upload failed, please try again. Error was: ' . $uploadErrors[$file['file']['error']] ); 567 } 568 569 else if ( !bp_core_check_avatar_size($file) ) { 570 $avatar_error = true; 571 $avatar_size = size_format(1024 * CORE_MAX_FILE_SIZE); 572 $avatar_error_msg = __('The file you uploaded is too big. Please upload a file under') . size_format(1024 * CORE_MAX_FILE_SIZE); 573 } 574 575 else if ( !bp_core_check_avatar_type($file) ) { 576 $avatar_error = true; 577 $avatar_error_msg = __('Please upload only JPG, GIF or PNG photos.'); 578 } 579 580 // "Handle" upload into temporary location 581 else if ( !$original = bp_core_handle_avatar_upload($file) ) { 582 $avatar_error = true; 583 $avatar_error_msg = __('Upload Failed! Your photo dimensions are likely too big.'); 584 } 585 586 else if ( !bp_core_check_avatar_dimensions($original) ) { 587 $avatar_error = true; 588 $avatar_error_msg = sprintf( __('The image you upload must have dimensions of %d x %d pixels or larger.'), CORE_CROPPING_CANVAS_MAX, CORE_CROPPING_CANVAS_MAX ); 589 } 590 591 if ( !$canvas = bp_core_resize_avatar($original) ) 592 $canvas = $original; 593 594 if ( $avatar_error ) { ?> 595 <div id="message" class="error"> 596 <p><?php echo $avatar_error_msg ?></p> 597 </div> 598 <?php 599 bp_core_render_avatar_upload_form( '', true ); 600 } else { 601 bp_core_render_avatar_cropper( $original, $canvas, null, null, false, $bp['loggedin_domain'] ); 596 602 } 597 603 } … … 623 629 624 630 function groups_manage_group( $step, $group_id ) { 625 global $bp ;631 global $bp, $create_group_step; 626 632 627 633 if ( is_numeric( $step ) && ( $step == '1' || $step == '2' || $step == '3' || $step == '4' ) ) { 628 // If this is the group avatar step, load in the JS.629 if ( $create_group_step == '3' )630 add_action( 'wp_head', 'bp_core_add_cropper_js' );631 632 634 $group = new BP_Groups_Group( $group_id ); 633 635 634 636 switch ( $step ) { 635 637 case '1': 636 if ( isset($_POST['group-name']) && isset($_POST['group-desc'])) {638 if ( $_POST['group-name'] != '' && $_POST['group-desc'] != '' && $_POST['group-news'] != '' ) { 637 639 $group->creator_id = $bp['loggedin_userid']; 638 640 $group->name = stripslashes($_POST['group-name']); … … 667 669 return $group->id; 668 670 } 671 672 return false; 669 673 break; 670 674 … … 703 707 704 708 case '3': 709 705 710 // Image already cropped and uploaded, lets store a reference in the DB. 706 711 if ( !wp_verify_nonce($_POST['nonce'], 'slick_avatars') || !$result = bp_core_avatar_cropstore( $_POST['orig'], $_POST['canvas'], $_POST['v1_x1'], $_POST['v1_y1'], $_POST['v1_w'], $_POST['v1_h'], $_POST['v2_x1'], $_POST['v2_y1'], $_POST['v2_w'], $_POST['v2_h'], false, 'groupavatar', $group_id ) ) … … 869 874 } 870 875 876 function groups_remove_data( $user_id ) { 877 BP_Groups_Member::delete_all_for_user($user_id); 878 } 879 add_action( 'wpmu_delete_user', 'bp_core_remove_data', 1 ); 880 add_action( 'delete_user', 'bp_core_remove_data', 1 ); 881 871 882 872 883 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)