Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 3 years ago

#8267 closed enhancement (maybelater)

Storing avatar information into usermeta

Reported by: stokim's profile stokim Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

Hi there!
I'm looking forward to 6.0, however there are few more things to add.
First, how about storing avatar information into DB, especially filename.
Now, to get avatar url, we have to use functions such as file_exist, readdir, closedir etc.
How about just storing avatar filename generated random id into usermeta?
I found this thread: https://buddypress.trac.wordpress.org/ticket/4237
However for 8 years, it has not been changed at all.
I know accessing db is costly, however it would be better to use DB instead of using those functions.
If we can store filename into usermeta, we can use this with attaching -thumb and -full with ease. Thank you.

Attachments (1)

avatar.patch (629 bytes) - added by stokim 5 years ago.

Download all attachments as: .zip

Change History (4)

@stokim
5 years ago

#1 @stokim
5 years ago

Only one line can change the way of fetching an avatar URL from poor directory check to DB inquiry.

Version 0, edited 5 years ago by stokim (next)

#2 @stokim
5 years ago

$serialized_avatar_url = get_user_meta( $user_id, 'avatar_url', true );
$avatar_url = $serialized_avatar_url ? maybe_unserialize( $serialized_avatar_url ) : null;
You can get both size's url through $avatar_url['thumb'] and $avatar_url['full'];

#3 @imath
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.