Support Forum

Assign avatars to users in batch-proces

EW Erik Wanrooij
Erik Wanrooij
Member

We have about 150 personal avatars that we’d like to assign for our users in some sort of batch-process.

I know we have to upload these to ../sp-resources/forum-avatars. Will it be hard to assign the avatars to our users by changing something directly in the database records? 

Regards,

Erik

3 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Not, shall we say, easy, easy but certainly doable.

The data for avatars is held in the ‘sfmembers‘ table in the ‘avatar‘ column. But, it is held in a php serialised array. For an uploaded avatar this takes the form of:

a:1:{s:8:”uploaded”;s:19:”yellowswordfish.jpg”;}

The problem – in case you do not know about serialised arrays – is that that number after the s: and before the file name, is the count of the number of characters that make up the data portion. Hence – ‘yellowswordfish.jpg’ – s:19 – representing a 19 character string of text.

The ‘sfmembers’ table is keyed on the user_id by the way.

So the main problem would be formatting that data for each individual…