- Code: Select all
$query="update {$this->data['config']['forum_prefix']}users u inner join {$roster->db->prefix}members m inner join {$roster->db->prefix}players p
set u.user_avatar = replace(\"{$this->data['config']['player_avatar']}\", \"%name%\", m.name)
where ucase(u.name) = ucase(m.name)
and p.name=m.name
and user_avatar=\"gallery/blank.gif\" /*only updates people with blank avatars*/
and p.name is not null"; /*only updates people who have uploaded to the roster*/
However, this is giving everyone the same avatar. I would think it was the query, but for one thing - When I run the sql that it reportedly used (from the debug output) through phpmyadmin, it works perfectly. I think it way be something to do with the replace, as a similar update works fine without the replace.
Any ideas?
Edit - it's definitely the replace. I ran it just using
- Code: Select all
set u.user_avatar = m.name
and it worked fine. Alternative is to update each user individually and do the replace in code rather than SQL but I would prefer to avoid that for speed reasons.