Topic-icon Proliferation of Avatar Icons

Active Subscriptions:

None
13 years 3 months ago #31110 by marbol
Using JFBConnect 4.3.4 with JomSocial 2.6.2 I have over 1300 avatar icons from Facebook for 14 users over a 2 month period of time! The JomSocial Profile settings are to Always Import Profile Data and Import Avatar.

It seems that a new avatar icon is created everytime the user logs in. The majority of profile icons are my own and I'm constantly going to the site.

Is this behavior known? unavoidable?

Let me know if I can provide additional information.

Thanks in advance,


Mark
The topic has been locked.
Support Specialist
13 years 3 months ago #31116 by alzander
Mark,
What directory are you seeing that proliferation of avatars in? In the temp directory, that wouldn't be surprising. I don't think they should be building up in the /images/avatar directory though. If so, let us know.

Just for reference, we *do* re-import the avatar from Facebook on each login (if JFBConnect is configured to always import), even if the image hasn't changed. We really wouldn't have a way to detect if the image changed. So, I'm not surprised there's a new import. Also, the temp directory could probably be cleaned up better, but it's a temp directory, which implies you're free to delete files as necessary. The other /images/avatar folder should be taken care of by JomSocial, I thought.. but perhaps we're doing something wrong.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 3 months ago #31118 by marbol
Thanks, Alex.

It is /images/avatar in which the build up is taking place.

Mark
The topic has been locked.
Support Specialist
13 years 3 months ago #31264 by alzander
Mark,
Thanks for the info. We hadn't forgot about you, just a bit busy with the new v5.0 release that just came out. We did investigate your report and have a minor code change that properly deletes old avatars when new ones are added.

I'm not sure if you upgraded yet, but the instructions below are for the Social Profiles - JomSocial v5.0.0 version. The same code will work on the JFBCProfiles - JomSocial v4.3.x release, you'll just need to find the right line of code (we can help if you can't).

To make the change, look for:
$jsUser = & CFactory::getUser($this->joomlaId);
        $jsUser->set('_avatar', $image);
        $jsUser->set('_thumb', $thumbnail);
        $jsUser->save();
In the new 5.0.0 version, that code starts at line 432. Once found, simply replace that block with the bigger block below:
$jsUser = & CFactory::getUser($this->joomlaId);
        $currentAvatar = $jsUser->_avatar;
        $currentThumb = $jsUser->_thumb;
        $jsUser->set('_avatar', $image);
        $jsUser->set('_thumb', $thumbnail);
        // Save and delete the old avatars, if they exist
        if ($jsUser->save())
        {
            if (JFile::exists(JPATH_SITE . '/' . $currentAvatar))
                JFile::delete(JPATH_SITE . '/' . $currentAvatar);
            if (JFile::exists(JPATH_SITE . '/' . $currentThumb))
                JFile::delete(JPATH_SITE . '/' . $currentThumb);
        }
We'd love to have your feedback on how that goes. This will definitely be in the next release, but having real-world tests is always great to have.

Thanks, and good luck,
Alex
The topic has been locked.