You can also use this below code.
customer_account_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
<referenceBlock name="page.main.title" template="Vendor_Module::template.phtml">
</referenceBlock>
</body>
</page>
template.phtml
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()):
?>
<h1 class="page-title">
<span class="base" data-ui-id="page-title-wrapper"><?php echo($customerSession->getCustomer()->getName()); ?></span>
</h1>
<?php endif; ?>
The reason why it's not working is because it's getting overwritten in the luma theme.
If you want to change that, create a theme that extends the luma theme and change it there.
Check the file under theme-luma/Magento_Customer/layout/customer_account.xml
If you change it there it will work, but.. you don't wanna change that directly in the luma theme.. ;) so extend the theme and voilĂ !
Create a custom theme and activate it. Make sure it's a child of the luma theme
theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>My new super awesome fabulous theme!</title>
<parent>Magento/luma</parent>
</theme>
then create the file in your new theme Magento_Customer/layout/customer_account.xml with these contents :
customer_account.xml
<?xml version="1.0"?>
<page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer-account-navigation-account-link">
<arguments>
<argument name="label" xsi:type="string"
translate="true">Awesome new dashboard
</argument>
</arguments>
</referenceBlock>
<!-- Change Account information -->
<referenceBlock name="customer-account-navigation-account-edit-link">
<arguments>
<argument name="label" xsi:type="string"
translate="true">My Profile</argument>
</arguments>
</referenceBlock>
</body>
</page>
Best Answer
You can see inside of
This part of code:
If you search for this block you arrive to this path:
Inside this file you can see this:
You can change with some conditions on registration page.