?
avatar Scrabble96
Scrabble96
4 Jan 2019

Steps to reproduce the issue

Added code to cassiopeia index.php to display welcome message if anyone other than guest is logged in:

	<?php if ($user->guest !=1) : ?>       
	   <div class="container-fluid">
		  <p class="floatleft">
                    <?php echo 'Welcome, ' . $user->name; ?>
	          </p>
		</div>
	<?php endif; ?>

Expected result

No message when viewing website as casual viewer

Actual result

Welcome,

System information (as much as possible)

J4.0 Alpha 7 nightly build from a few days ago on CloudAccess.net Joomla site.

Additional comments

Original code which works correctly on Joomla! 3.9.1 site which has the same error in J.4.0 as the code above:

	<?php if ($user->guest !=1) { ?>       
	   <div class="container-fluid">
		  <p class="floatleft">
                    <?php echo 'Welcome, ' . $user->name; ?>
                  </p>
		</div>
    <?php } ?>

avatar Scrabble96 Scrabble96 - open - 4 Jan 2019
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Jan 2019
avatar Scrabble96 Scrabble96 - change - 4 Jan 2019
The description was changed
avatar Scrabble96 Scrabble96 - edited - 4 Jan 2019
avatar Bakual
Bakual - comment - 4 Jan 2019

Where exactly do you want that code change? In the login module?
Imho, that one already has an option to enable such a greeting which only applies when someone is logged in.

avatar infograf768
infograf768 - comment - 4 Jan 2019

The code posted above, btw, does not exist in 3.9.x core.

avatar Scrabble96
Scrabble96 - comment - 4 Jan 2019

Thanks, @Bakual
I couldn't find it in the index.php (which is where it is in my current J3x template, created by me). I'll set up a front-end user later then log in to see what happens and where the welcome message is displayed.

avatar infograf768
infograf768 - comment - 4 Jan 2019

The code we use in core is in the module and will display only when a user has logged in:

<?php if ($params->get('greeting', 1)) : ?>
	<div class="login-greeting">
	<?php if (!$params->get('name', 0)) : ?>
		<?php echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('name'), ENT_COMPAT, 'UTF-8')); ?>
	<?php else : ?>
		<?php echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username'), ENT_COMPAT, 'UTF-8')); ?>
	<?php endif; ?>
	</div>
<?php endif; ?>
avatar Bakual
Bakual - comment - 4 Jan 2019

For reference where the code from JMS is:

<?php if ($params->get('greeting')) : ?>
<div class="mod-login-logout__login-greeting login-greeting">
<?php if ($params->get('name') == 0) : ?>
<?php echo Text::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('name'), ENT_COMPAT, 'UTF-8')); ?>
<?php else : ?>
<?php echo Text::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username'), ENT_COMPAT, 'UTF-8')); ?>
<?php endif; ?>
</div>
<?php endif; ?>

I'm closing this issue as it's not about core. If you need assistance to adjust your own template, feel free to ask in the forums.

avatar Bakual Bakual - change - 4 Jan 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-01-04 11:15:30
Closed_By Bakual
avatar Bakual Bakual - close - 4 Jan 2019
avatar Scrabble96
Scrabble96 - comment - 4 Jan 2019

Thank you both @infograf768 and @Bakual

Add a Comment

Login with GitHub to post a comment