Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to tell if a person has uploaded a avatar only once?


Tosh
Participant

@xberserker

$avatar_dir = ‘avatars’;
$item_id = $bp->displayed_user->id;
$object = ‘user’;

$avatar_folder_url = apply_filters( ‘bp_core_avatar_folder_url’, str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ) . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );
$avatar_folder_dir = apply_filters( ‘bp_core_avatar_folder_dir’, BP_AVATAR_UPLOAD_PATH . ‘/’ . $avatar_dir . ‘/’ . $item_id, $item_id, $object, $avatar_dir );

f ( file_exists( $avatar_folder_dir ) ) {

// Run code if user hasn’t uploaded a avatar

} else {

// Run code if they have a avatar uploaded already

}

Correct? Thanks for your help Ray.

Skip to toolbar