Product Updates
Joomla 5.2.3 Compatibility for JA Templates, Bug Fixes, and More

How can I get JomSocial profile pictures to display on the site?

I am using component "JComments 3.0.7" and plugin "JComments - Avatar 4.1.8" on the site.
Unfortunately, plugin JComments - Avatar does not currently display avatars from the JomSocial component.

Please tell me which line I need to change so that this component can display avatars from JomSocial.

Code:

case 'jomsocial':
				if (count($users)) {
					$db->setQuery('SELECT userid, thumb as avatar FROM #__community_users WHERE userid in (' . implode(',', $users) . ')');
					$avatars = $db->loadObjectList('userid');
				}

				$avatarA = JPATH_SITE . DS;
				$avatarL = JURI::base() . '/';

				foreach ($comments as &$comment) {
					$uid = (int)$comment->userid;

					$comment->profileLink = $uid ? JRoute::_('index.php?option=com_community&view=profile&userid=' . $uid) : '';

					if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '' && $avatars[$uid]->avatar != 'components/com_community/assets/default_thumb.jpg') {
						if (file_exists($avatarA . $avatars[$uid]->avatar)) {
							$comment->avatar = $avatarL . $avatars[$uid]->avatar;
						}
					}
				}
				break;

    Ninja I'm not a developer, but after an hour of work, I realized that I need to find this line:

    $db->setQuery('SELECT userid, thumb as avatar

    and replace it with:

    $db->setQuery('SELECT userid, avatar as avatar

    Now all avatars are displayed correctly in JComments.

    I really hope that your developers will make a migrator of JComments comments to JomSocial (plugin - Article Comments), since I want to use the notification system from JomSocial and a uniform style of posts on my site. I wrote earlier about this here - https://www.joomlart.com/forums/d/31157-jomsocial-article-comments-plugin

      eminem08
      Hi
      Your feedback was already shared with team, if there is huge demand it maybe considered.

        Ninja I now understand why the avatars could not be displayed. When I transferred all users from CommunityBuilder to JomSocial with the help of your migrator, then the avatars were transferred with the wrong url-path value.

        Earlier I had a problem with a migrator and you helped me - https://www.joomlart.com/forums/d/26558-community-builder-migrator-problem-with-profile-fields

        in the screenshot below, I showed 2 problems that I saw in table j25_community_users:

        1. the path to the avatar is shown at the beginning along with the "/" sign. This path starts with /image and should just start with image.
        2. the path to thumb is shown like this: /var/www/site/data/www/site.com/images/avatar, and should be shown in the table in the same way as field avatar.

        This problem only exists with users who were transferred from the CommunityBuilder component using your built-in JomSocial migrator.

        For example, there are users who registered on the site after migration and they do not have the above problems:

        Ninja what query should I execute on the database to fix this problem?

          eminem08
          Hi,
          This might be an error of cb migration. You can try these steps:

          • Open file administrator\components\com_community\controllers\migrators.php
          • Find this string $model->storeAvatar($userId,$avatarPath,$newPathThumb);
          • Replace with $model->storeAvatar($userId,$avatarPath,$avatarThumbPath);
          • Then run migration again.

            manhta Almost a year has passed, I will not run the migration process again, because then all the fields and settings will go astray.

            I'll just manually change the URLs for the images in the database.

            Write a Reply...
            You need to Login to view replies.