Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: mathx on September 19, 2022, 05:03:26 PM

Title: Custom avatars not being served, just generic (which are missing)
Post by: mathx on September 19, 2022, 05:03:26 PM
This topic is as old as a dead horse, but most >120 days. My problem seems unique. Apologies if redundant.

Custom avatars are not working. The /avatars and /attachments dirs didnt exist for some reason on upgrade from 2.0.x, so it was recopied from backup. No avatars/default.png either somehow (symlinked to Oxygen/invisible_user.png for now, works).

But default.png should not be every user's avatar - should be custom. SMF is serving up a 404 default.png, not a custom db-query-looking url which as I'd expect (Im new to SMF helping a less savvy forum operator, but i got lots of linux/debian experience).

This seems busted such that no db query is attempted to customize long-term users' avatars which def existed & worked under 2.0.x, now merely serving up default.png (busted til I hammered in the symlink).

I dont believe a repair_settings.png to fix a path sounds like the solution here (and I think he already ran it). Just reran with no love.

Small hints: a few users avatars work, but those are in the db as smf_member:avatar as full URLs. All others are blank. (one is a url that points back at the forum itself to /gallery/something and works fine - is that the usual format of a local avatar file? a self-pointing url into the gallery?)

Either way, how did these all get blanked? I can boot the old instance and extract whatever db values all users had for their avatars but this seems like a massive erasure of data via the upgrade tool.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Illori on September 19, 2022, 05:13:14 PM
the upgrade moves the users avatars to another folder, they were stored in the attachments folder. you need to restore your working 2.0.* forum and run the upgrade again with the attachments folder in place.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: mathx on September 20, 2022, 12:35:43 AM
Course we did that in the first place, but avatars were not working after, thus me investigating. Too much other work has been done to fix the new install back to working to go back and reupgrade (plus many new posts in the boards now that they're half working). So there's no going back.

Where were avatars moved to, and why are db entries in smf_members avatar field blank? Where are custom avatars in the db if smf_members:avatar is blank?
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Kindred on September 20, 2022, 02:03:09 AM
There's no reason that the upgrade would have blanked the dBase entries
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: mathx on September 20, 2022, 10:31:13 AM
It seems not to have, I looked at an old copy I can boot - most users' avatar field is blank (except 10 of 350+ users with avatars). I went back a few weeks before the upgrade and see the same.

What's much more likely is I dont understand the table structures for SMF and not all avatars are necessarily stored in smf_members:avatar, but elsewhere. (Where?)

This thread came very close but just missed giving the answer by a hair: https://www.simplemachines.org/community/index.php?topic=281897.0

Uploading a new avatar works, I found it here

151502     21 -rw-r--r--   1 www-data www-data    19312 Sep 20 10:52 custom_avatar/avatar_647_1663685534.png

Now I assume that all the old avatars are in the attachments dir, but which are avatar files and which are not? Id need to query a table in the db to find out and manually move all those files into place into the custom_avatar dir.

I can see in smf_attachments attachment type 1 is for avatars, and querying for all matching attachments shows only one: my newly uploaded (and working) avatar. So I wont find old avatar filenames in there. :(

Please keep in mind as you read this was we *did the upgrade by the book* and since then we've started using the forum, too much to rollback. However, I can run mysql queries right off the cmd line through awk|sed|grep|cut|whatever to get a list of files to mv to the custom_avatars dir easily. Just need to know how to get the filenames to move from the db.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 20, 2022, 06:32:38 PM
In 2.0 all attachments and avatars are in /attachments directory, attachment filenames are hashed, avatars are not.  2.1 upgrade adds .dat extension to hash, and moves avatars to /custom_avatar.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: mathx on September 21, 2022, 10:19:52 AM
That's very helpful.

I am wondering how to determine in 2.0 where an avatar is in the db, if not in smf_members:avatar (that's only for external avatars, not uploaded or gallery). Then I can figure out which filename is where and either copy it over or move it to the right place. (And then figure out how they're structured in 2.1.2 in the db and ensure all that is properly setup..)
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 21, 2022, 12:26:48 PM
Uploaded avatars are in _attachments table, same as attachments.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: mathx on September 21, 2022, 01:01:04 PM
yeah but how is it determined that a user's avatar to use is from that table and not a generic one or an external url?

and I need to know this for 2.0 as well so I can go find the old avatars on the old system. :P
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 21, 2022, 01:03:47 PM
Don't have time to check right now, but there's an 'avatar' field in _members table, I believe generic and linked avatars are stored there.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Kootch on September 28, 2022, 01:33:56 PM
Since he upgrade,

1.  when users try to add an avatar, it gives an error of timing out when they attempt to upload one in Profile Details.

2.  users custom avatars that were a part of the forum before the upgrade are not available as an option any longer.  Is there a quick fix I can do for that, and how?

Thanks!

Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 28, 2022, 09:39:39 PM
What's in /custom_avatar?
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Kootch on September 29, 2022, 01:31:24 AM
Quote from: Sir Osis of Liver on September 28, 2022, 09:39:39 PMWhat's in /custom_avatar?

I'm not the most techie guy.  I don't seem to have a /custom_avatar directory when I look through FTP.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 29, 2022, 05:30:29 PM
Are you running 2.1 or 2.0?
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Kootch on September 29, 2022, 07:06:06 PM
2.1.2

https://www.tmlfans.ca/community
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 29, 2022, 07:12:14 PM
A 2.1 install should have a /custom_avatar directory in forum root,  whether it was installed from scratch or upgraded from previous version.  If you don't see that directory then your forum is incomplete, and uploaded avatars will not work.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 29, 2022, 07:25:26 PM
Quote from: Sir Osis of Liver on September 20, 2022, 06:32:38 PMIn 2.0 all attachments and avatars are in /attachments directory, attachment filenames are hashed, avatars are not.  2.1 upgrade adds .dat extension to hash, and moves avatars to /custom_avatar.

Just rereading this topic, your problem appeared after upgrading from 2.0.  If you don't have /custom_avatar directory, uploaded attachments should still be in /attachments directory, they're the files with unhashed filenames.  Members will be unable to upload avatars if the /custom_avatar directory is missing.  2.1 upgrader sometimes fails to rename attachments and/or move avatars from /attachments to new directory.   Recommended solution is to rerun upgrade, but if you're too far into 2.1 to do that without losing content, you can try fixing it manually by creating /custom_avatar and moving avatars into that directory.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Kootch on September 29, 2022, 07:37:02 PM
Should I be creating that /custom_avatar in the root directory of the forum, or created inside the /avatars directory?
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Kootch on September 29, 2022, 08:10:48 PM
Quote from: Kootch on September 29, 2022, 07:37:02 PMShould I be creating that /custom_avatar in the root directory of the forum, or created inside the /avatars directory?

I tried to create a /custom_avatar directory but it won't let me, via FTP. It's like there's one there, hidden or something?!  I'll go in via command line tomorrow when my head isn't pounding :)
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 29, 2022, 11:24:09 PM
It's in the forum root.  If you have cpanel, try creating the directory with file manager.
Title: Re: Custom avatars not being served, just generic (which are missing)
Post by: Sir Osis of Liver on September 30, 2022, 12:35:02 PM
If you're still not getting this, upload a clean set of 2.1.2 files from large upgrade package (don't need the upgrade files), that will replace existing files and directories, and should add empty /custom_avatar.  You'll have to reinstall your theme and mods.  Check /attachments, all hashed filenames should have .dat extension.  You'll have to manually move uploaded avatars from /attachments to /custom_avatar.