Re: Avatar Upload Issues
WP – 3.0.1
BuddyPress – 1.2.5.2
Buddypress theme with compatibility
Ok.. I want to make clear the problem I have been having with my Avatar Cropping process in my BuddyPress installations.
I can crop successfully on my dashboard, Using the “User-Avatar” plugin. But then I installed buddypress and when users attempt to build their own avatars inside the themed site, the only thing I get is a cropped preview of the top left corner of any picture I choose(both pictures display properly), but no ability to crop or even see the cropping elements.
I have read thru the solutions, and tried to implement them. First.. I use “qian-ava”s solution. I am using WP 3.0… so I need to find my Upload paths by going to..
SETTINGS -> MEDIA
When there I add to the Uploading Files fields by entering “wp-content/uploads” into the” Store uploads in this folder” area and my full path of http://www.ningbotoday.com/wp-content/uploads/ into the “Full URL path to files” area. Just note… I added all the double quotations.
After I do this I attempt to go into line 389 of my bp-core-avatars.php file and…
‘Replace:
if ( !$path = get_option( ‘upload_path’ ) )
$path = WP_CONTENT_DIR . ‘/uploads’;
With:
if ( !$path = get_option( ‘upload_path’ ) )
$path = WP_CONTENT_DIR . ‘/uploads’;
else $path = ABSPATH . $path;’
But… I do not have the “if” statement to replace! The closest thing I have is from 384 – 390…
‘if ( empty( $bp->avatar_admin->resized ) )
$bp->avatar_admin->image->dir = str_replace( BP_AVATAR_UPLOAD_PATH, ”, $bp->avatar_admin->original );
else {
$bp->avatar_admin->image->dir = str_replace( BP_AVATAR_UPLOAD_PATH, ”, $bp->avatar_admin->resized );
@unlink( $bp->avatar_admin->original );
}’
But I don’t see anything that I can replace. So either way.. I tried to test the script and just pop it in nearest to the line 389 to no avail. I ended up getting an error and my page does not load. Back to the drawing board. I reversed the process and started again.
I then took “Creay”s advise (https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/avatar-upload-issues/?topic_page=7&num=15#post-70855), because his problem directly describes mine, and decided to look into the expression of Jcrop and its possibility of not firing off. He changed core-cssjs.php inside the pb-core folder inside the buddypress plugin. He added
‘<script src="/wp-includes/js/jcrop/jquery.Jcrop.js”>’
After the line ‘$aspect_ratio = (int) constant( ‘BP_AVATAR_FULL_WIDTH’ ) / (int) constant( ‘BP_AVATAR_FULL_HEIGHT’ ); ?>’
I have a area in my bo-core-cssjs.php file that reads between line 88-91
‘ // Calculate Aspect Ratio
if ( (int) constant( ‘BP_AVATAR_FULL_HEIGHT’ ) && ( (int) constant( ‘BP_AVATAR_FULL_WIDTH’ ) != (int) constant( ‘BP_AVATAR_FULL_HEIGHT’ ) ) )
$aspect_ratio = (int) constant( ‘BP_AVATAR_FULL_WIDTH’ ) / (int) constant( ‘BP_AVATAR_FULL_HEIGHT’ );
?> “
So after the ?> I added the line. Nothing. Still not getting the crop to work properly. I encourage anyone to take a try and register on the site.. I would like to nail this problem down before I launch the site or even more to far forward. The site is http://www.ningbotoday.com
Thank you for all your help in advance.