By default, Magento 2 Social Login Pro extension displays customer profile photos next to the username in the header. Please follow the guide below to manually set their custom location.
Changes to be made
Customer photo on My Account page
Go to the needed phtml file and insert the following code in the place where the customer’s profile photo from the social network should appear:
<?php if ($photoPath = $this->helper('Plumrocket\SocialLoginPro\Helper\Data')->getPhotoPath()) : ?>
<img src="<?php echo $photoPath; ?>" />
<?php endif; ?>
Code Example
Please paste the above code into the file:
vendor/magento/module-theme/view/frontend/templates/html/title.phtml
Result will be as follows:
$cssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : '';
$title = '';
if (trim($block->getPageHeading())) {
$title = '<span class="base" data-ui-id="page-title-wrapper" ' . $block->getAddBaseAttribute() . '>'
. $block->escapeHtml($block->getPageHeading()) . '</span>';
}
?>
<?php if ($title): ?>
<?php if ($photoPath = $this->helper('Plumrocket\SocialLoginPro\Helper\Data')->getPhotoPath()) : ?>
<img src="<?php echo $photoPath; ?>" />
<?php endif; ?>
<div class="page-title-wrapper<?php /* @escapeNotVerified */ echo $cssClass; ?>">
<h1 class="page-title"
<?php if ($block->getId()): ?> id="<?php /* @escapeNotVerified */ echo $block->getId();?>" <?php endif; ?>
<?php if ($block->getAddBaseAttributeAria()): ?>
aria-labelledby="<?php /* @escapeNotVerified */ echo $block->getAddBaseAttributeAria(); ?>"
<?php endif; ?>>
<?php /* @escapeNotVerified */ echo $title ?>
</h1>
<?php echo $block->getChildHtml(); ?>
</div>
<?php endif; ?>
1. Social Login Pro buttons on the My Account page.
Was this article helpful?