displaying user name when user is connected to the site

Permalink 1 user found helpful
Hello, So I've enable public registration on my site.

I tried to register a test identity and everything seems to work great... However when a user connects to the site, after he or she has been redirected to the main page, there is no more signs of the user being connected.

In most site, when you connect to your account, you'll see a little piece of text somewhere (usually on top) saying something like : "you are logged on as (...)", or : "welcome (...)"

Anything that let the user know he or she is connected...

Is there such a feature in C5? Or an add-on I don't know about.

Thanks your help is appreciated.

infinityunit
 
Adreco replied on at Permalink Reply
Adreco
I believe this is theme specific. Check the footer.php in your elements folder. I'm pretty sure the default C5 themes have this feature
infinityunit replied on at Permalink Reply
infinityunit
Hi, Thanks for your answer.

I'm using the "Organica Responsive - 1.1" theme that I bought... I believe this theme was developed by the C5 developement team.

I've downloaded the footer.php file and the header.php file, but to the best of my knowledge in programming (which is limited). I couldn't find if such a function exists on this theme...

I will probably have to contact the support team of this particular add-on...

Thanks. If you have any other ideas, please let me know :)
Adreco replied on at Permalink Reply
Adreco
The theme support would be the best place for advice on this theme. BTW, I believe the C5 Theme team is a private group (not to be confused with the development team).

While waiting for their response, you may find it helpful to view the footer.php from a downloaded C5 installation to compare with the footer.php in your theme.
It would be found in Concrete > Themes > Default > Elements
MysteriousCleon replied on at Permalink Best Answer Reply
MysteriousCleon
If this can help you, you can put somewhere in your template this code:

<?php 
         $u = new User();
         if ($u->isRegistered()) { ?>
            <?php  
            if (Config::get("ENABLE_USER_PROFILES")) {
               $userName = '<a href="' . $this->url('/profile') . '">' . $u->getUserName() . '</a>';
            } else {
               $userName = $u->getUserName();
            }
            ?>
            <span class="sign-in"><?php echo t('Logged in as <b>%s</b>.', $userName)?> <a href="<?php echo $this->url('/login', 'logout')?>"><?php echo t('Sign out.')?></a></span>
         <?php  } else { ?>
            <span class="sign-in"><a href="<?php echo $this->url('/login')?>"><?php echo t('Sign in.')?></a></span>
         <?php  } ?>


It will create "Sign in." link when you are not signed in, and when you log in it sais: "Logged in as Awasome_Nickname. Sign out."
infinityunit replied on at Permalink Reply
infinityunit
Hey MysteriousCleon,

great piece of code... I had to tweak it a little bit but it worked well. Many thanks

:)
C5ThemeTeam replied on at Permalink Reply
C5ThemeTeam
Thanks for downloading my theme. Also thanks to MysteriousCleon for that snippet of code and answering the question for me. You gotta love the C5 community.

InfinityUnit, if you need any more assistance, just shoot me a message through support.

Steve
C5ThemeTeam