Code needed to put a Welcome "Username" message on a HTML webpage for aMember Pro?

Discussion in 'Customization & add-ons' started by lamont17, Apr 24, 2008.

  1. lamont17

    lamont17 New Member

    Joined:
    Apr 9, 2008
    Messages:
    9
    Hello

    What is the code needed to put a Welcome "Username" message on a HTML webpage for aMember Pro?

    I am presently running the Demo for aMember Pro software and for me this is a very important function so that the user will no whether they are logged in, or not.

    Maybe the code could display a "Not Logged In" message if the user is not logged in.

    Thanks in advance people.
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
  3. jnabb

    jnabb New Member

    Joined:
    Jun 23, 2008
    Messages:
    3
    I didn't see how this works for html page. Is it possible for an HTML page?
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    Change your .html file name to .php and use the integration guide:
    PHP pages look exactly the same as html, but they can also run php code.

    Or are you talking about the /amember/templates/ files?

    David
  5. jbround39

    jbround39 aMember Pro Customer

    Joined:
    Mar 20, 2008
    Messages:
    61
    If you're trying to do this in header.html, here's some code that will fit in. It's got my image code in it, so you'll need to replace that with your own submit image or just a submit button. But otherwise, this is very generic.

    If you want to put it on some other html page other than the header template, do what David says, change the file name to .php and replace {php} with <?php and {/php} with ?>

    {php}

    if ($au=$_SESSION['_amember_user']){ // user is logged-in

    print " <div>Hello <strong><em>$au[name_f] $au[name_l]</em></strong>! (<a href='/amember/logout.php'>Logout</a>)</div>";

    } else {
    print " <div>Username</div>
    <div>
    <form name=\"login\" method=\"post\" action=\"/amember/login.php\">
    <label>
    <input name=\"amember_login\" type=\"text\" class=\"txtbox\" id=\"textfield\" size=\"9\" />
    </label>
    </div>
    <div>Password</div>
    <div>
    <input name=\"amember_pass\" type=\"password\" class=\"txtbox\" id=\"textfield2\" size=\"9\" />
    </div>
    <input type=\"hidden\" name=\"login_attempt_id\" value=\"<?php print time(); ?>\" />
    <div><input type=\"image\" width=\"26\" height=\"26\" src=\"/amember/img/bt_go.jpg\" alt=\"Go\"/></div>
    </form>";
    }
    {/php}

Share This Page