Skip to:

Opened 4 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:


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:
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 4 years ago.

Download all attachments as: .zip

Change History (4)

4 years ago

#1 @stokim
4 years ago

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

Last edited 4 years ago by stokim (previous) (diff)

#2 @stokim
4 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.