I am working on a migration work to WordPress for a site where all user images of old site has to set as avatars in WordPress buddypress profile.

I wrote a PHP script to migrate all users along with passwords and working fine.

My problem is how to set user avatar using PHP code (not WordPress code). I didn't understand how it is storing and where in tables it is storing. I know the location it is storing be in format like,

wp_content/uploads/avatars/userid/randomtext.jpg

How this randomtext.jpg is generating and where this information is saving?

Can anyone help me?

有帮助吗?

解决方案

Thats it you dont have to create any random text. Just create a directory with userid as name in inside "avatars" folder and save two images like say for userid (22),

wp_content/uploads/avatars/22/22-bpfull.jpg (150x150px) wp_content/uploads/avatars/22/22-bpthumb.jpg (50x50px)

or wp_content/uploads/avatars/22/anyname-bpfull.jpg wp_content/uploads/avatars/22/anyname-bpthumb.jpg

Thats it. No need to store in any table. Just create images in respective directories.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top