Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Guest and User States
  • Posted: 02.08.2004, 18:42
     
    thevdo
    rank:
    Softmore Softmore
    registered:
     May 2004
    Status:
    offline
    last visit:
    02.05.05
    Posts:
    71
    I want to have a diferent welcome message for users not logged and users who are, but I dont know all the information needed. Just needing to know the username variable. So it will say "welcome postnuke2004" etc.

    Code

    <?php if (pnUserLoggedIn()) {
    echo "Welcome <username>";
    } else {
    echo "Welcome Guest. Become a user <a href="user.php?op=register&module=NS-NewUser">today</a>";
    } ?>
  • Posted: 02.08.2004, 21:32
     
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    online
    Posts:
    7720
    To get the username use the pnUserGetVar API. Speicifically pnUserGetVar('uname') will get the username of the currently logged in user.

    -Mark
  • Posted: 03.08.2004, 00:53
     
    thevdo
    rank:
    Softmore Softmore
    registered:
     May 2004
    Status:
    offline
    last visit:
    02.05.05
    Posts:
    71
    Mate I don't know my PHP, been trying to work out how to implement. Shoot me but well my PHP learning has not even really begun. Can you show an example of how this code is implemented?
  • Posted: 03.08.2004, 00:56
     
    scorduan
    rank:
    Freshman Freshman
    registered:
     August 2004
    Status:
    offline
    last visit:
    03.08.04
    Posts:
    10

    Quote





    I think this is the idea. But my PHP is relearnt everytime I have to go hack someone else's PHP.
  • Posted: 03.08.2004, 01:18
     
    thevdo
    rank:
    Softmore Softmore
    registered:
     May 2004
    Status:
    offline
    last visit:
    02.05.05
    Posts:
    71
    There is an error when using a hyperlink in the fourth line. Also when the link is removed the code works but when loggied in it does not display the welcome message and the corresponding username, it just displays '0'. Any more ideas?
  • Posted: 03.08.2004, 02:11
     
    scorduan
    rank:
    Freshman Freshman
    registered:
     August 2004
    Status:
    offline
    last visit:
    03.08.04
    Posts:
    10
    Well... The link is what you had originally posted, so I can't speak to that... ON the second issue... My guess is that I screwed up the PHP concatenation operator...

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula