Welcome "Username"

By DanMaitland - October 24, 2010

Hi,
I am currently trying to use the membership login plugin and I was wondering if there was a way to display on any given page once the user has logged in a message that would say something along the lines of welcome"username" or you are logged in as "username" or simply change the "login" link to "Log off" if they are logged in. I can't seem to find anything on this in the forum. Thanks.

Re: [Dan Maitland] Welcome "Username"

By gkornbluth - October 25, 2010 - edited: October 25, 2010

Hi Dan,

If memory serves me, you can just echo the username field in the accounts editor for $CURRENT_USER.

Look at this post which might give you an idea: http://www.interactivetools.com/forum/gforum.cgi?post=84028

Sorry I can't access the code I used right now, but do a search on the forum for $CURRENT_USER and you should find other stuff.

I actually added a first_name and last_name field to replace the full_name field and use that to make my communications more friendly.

Hope that works for you.

Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Welcome "Username"

By DanMaitland - October 25, 2010

Thanks Jerry. I tried to get it to work but I still cant get it. I really thought that since the membership plugin was installed that there really wouldn't be that much code involved to get this to work.

Re: [Dan Maitland] Welcome "Username"

By gkornbluth - October 25, 2010 - edited: October 25, 2010

Try this...

<?php if (@$CURRENT_USER): ?> Welcome <?php echo htmlspecialchars($CURRENT_USER['username']); ?> <?php endif ?> You can replace the username with any field name that exists in the accounts record.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [Dan Maitland] Welcome "Username"

By Chris - October 25, 2010

Hi Dan,

What's going wrong? Are you getting errors or is nothing showing up? Can you post the code you're using?
All the best,
Chris