Skip to content
Logo
  • Support
  • My account
  • My cart
  • Magento 2 Extensions
  • Magento 1 Extensions
  • Magento Services
  • Packages
  • Special Offers
  • Blog
  • Contact Us

Home Magento 2 Extensions Magento 2 Social Login Pro Documentation v4 Developer Guide How to Set a Custom Location for a User Profile Photo

    • Installation
    • Updating
    • Configuration
    • Integrations
    • How-To Guides
    • Troubleshooting
      • Adding Social Buttons Manually
      • Setting Custom Location for User Profile Photo
      • Adding Custom HTML
      • Setting Custom Design for Social Login Buttons On a Specific Form
      • Adding customer photo in the header in Hyvä
      Developer Guide & API Reference
    • Translation
    • Uninstalling
    Magento 2 Social Login Pro - Documentation

How to Set a Custom Location for a User Profile Photo

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.

Magento 2 social login developer guide

Was this article helpful?
08/19/202208/19/2022
Search
Search
Generic selectors
Exact matches only
Search in title
Search in content
Contents
Company
  • Home
  • About Plumrocket Inc.
  • Customer Stories
  • Programs & Promotions
  • Careers
  • Contact Us
Legal
  • Terms of Service
  • Privacy Policy
  • Refund Policy
  • Cookie Policy
  • Privacy Center
  • Updates & Support Policy
Resources
  • Blog
  • FAQ
  • Documentation
  • Tutorials
Partners
  • Partner Program
  • Affiliate Program
  • Official Partners
Plumrocket Inc. © 2008 - 2025
Follow Us:
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube