Skip to:
Content

BuddyPress.org

Opened 18 months ago

Closed 3 weeks ago

#8267 closed enhancement (maybelater)

Storing avatar information into usermeta

Reported by: 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 18 months ago.

Download all attachments as: .zip

Change History (4)

@stokim
18 months ago

#1 @stokim
18 months ago

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

Last edited 18 months ago by stokim (previous) (diff)

#2 @stokim
18 months 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 weeks ago

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