Home page link on login and registration pages.

HGMNinja

New Member
Im not sure judging by what others are asking as I thought this was a suggestion forum.

So here goes..

I had to add the following code to the vews/login.php and register.php files as there really should be a link back to the home page for convenience.

Here's what I added:

<?php $imageUrl = "https://maildomain.com/images/Logo.png";

$imageWidth = 275; // Adjust as needed
$imageHeight = 100; // Adjust as needed

echo "<div style='text-align: center;'><a href='https://maildomain.com'><img src='$imageUrl' alt='Mail Domain Logo' width='$imageWidth' height='$imageHeight'></a></div><br>";
?>

I got the code from chatgpt. But really there should be a link from these pages back to the home page.

In my setup, I installed MW in a folder within the root. I installed Joomla in the root so I could design a page. That all looks and works fine as I added the Home, Login and Signup links in the Joomla header/main menu.

So then had to add the above code to link back to the homepage.

But the link seems to be necessary anyway as its a dead end in the journey.

Anyways, thought I would suggest it be added as I realize the files will be overwritten and I will need to redo this again.

Thanks.

PS: Also, is there a custom way to add the image link without having to edit the login and register php files?

Thanks.
 
Open apps/ directory and inside, create a file called init-custom.php that contains:
PHP:
<?php

hooks()->addAction('before_active_form_fields', function(CAttributeCollection $collection) {
    
    $controller = $collection->itemAt('controller');
    $isGuestPage = $controller->getId() === 'guest';
    
    if (!$isGuestPage) {
        return;
    }

    $imageUrl = "https://maildomain.com/images/Logo.png";
    $imageWidth = 275; // Adjust as needed
    $imageHeight = 100; // Adjust as needed

    echo "<div style='text-align: center;'><a href='https://maildomain.com'><img src='$imageUrl' alt='Mail Domain Logo' width='$imageWidth' height='$imageHeight'></a></div><br>";
    
});

This will inject your image in all guest pages: login/register/forgot password, in both, customer and backend area.
 
And also is safe for upgrades.

Awesome Thanks. If I were to say anything it would be that it would be better above the main headline text of those pages. For example. On the guest login page it says, "Sign in to start your session". The the logo after that line. It would be better if the logo was above that line. Same with the Register text on the signUp page. But I canm live with it as is if its not going to get over written.

Thanks for the great support and knowing what you're talking about.
 
Back
Top