[buddypress-trac] [BuddyPress] #1231: Legacy avatars sometimes shown after upgrade

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Wed Oct 14 17:28:57 UTC 2009


#1231: Legacy avatars sometimes shown after upgrade
-----------------------------------+----------------------------------------
Reporter:  swinton                 |       Owner:       
    Type:  defect                  |      Status:  new  
Priority:  major                   |   Milestone:  1.1.2
Keywords:  avatars legacy bp-core  |  
-----------------------------------+----------------------------------------
 After an upgrade (from 1.0.3 to 1.1.1), legacy avatars are sometimes shown
 for users even after they have uploaded a new avatar.

 The order in which avatars are read from the filesystem is unpredictable,
 since readdir returns files in the order in which they are stored by the
 filesystem, not necessarily in reverse chronological order, which is the
 desired functionality.

 A cross-platform fix, which still uses readdir, is attached.

 Basically we use an array to define the relative priorities of the avatars
 we wish to fetch:

 1. -bpfull / -bpthumb
 2. -avatar2 / -avatar1
 3. -groupavatar-full / -groupavatar-thumb

 We loop over the array of 'avatar suffixes' and break as soon as one is
 found.

 One drawback of this approach is that we may open a dir handle and read
 from the filesystem up to 3 times, which isn't great.

 It would probably be better if the latest avatar was stored as meta data
 in wp_usermeta, but this fix is provided as a workaround in the
 meantime...

-- 
Ticket URL: <http://trac.buddypress.org/ticket/1231>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list