Not able to show amember first/last name fields on php page

Discussion in 'Integration' started by alanpeto, Nov 11, 2010.

  1. alanpeto

    alanpeto New Member

    Joined:
    Dec 28, 2004
    Messages:
    29
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Are you adding it to an HTML or PHP page?

    If it is PHP, make sure you have the <?php session_start(); ?> at the beginning of your file.
  3. alanpeto

    alanpeto New Member

    Joined:
    Dec 28, 2004
    Messages:
    29
    Hi, yes to a php page and I do have that at the start of the page.

    Here is an example of the test.php page I created (stripped it down to this and it still didn't work):

    PHP:
    <?php session_start(); ?>            

    <font face="Georgia" size="5">
    <?php
    print "Welcome, " $_SESSION['_amember_user']['name_f'] . " " $_SESSION['_amember_user']['name_l'];
    ?>
    </font>
    Should I be putting something else into the .php page?
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
  5. alanpeto

    alanpeto New Member

    Joined:
    Dec 28, 2004
    Messages:
    29
    Hi David,

    print_r($_SESSION): displayed: "Array ( )" and that was it.
    Looked at the first thread, but I'm honestly kinda lost what it was even talking about, and the second thread was restricted so I couldn't see it.

    Is there something I should be adding to my php page? This php page is only in the protected directory...it's not in the amember script directory.

    Thank you again for everyones help!

  6. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    @alanpeto: what are you using to server your content? (wordpress, etc)

    Could be that your content script is potentially clearing your session data?
  7. alanpeto

    alanpeto New Member

    Joined:
    Dec 28, 2004
    Messages:
    29
    Hi skippybosco,

    The php page is just a regular php page only to display this content as a landing page in the secure directory. There are other sub-directories within this directory, but they have no impact on that page.

    No other content on that page / script that would impact it. I even created a clean php page with just the recommended code (see first post) and still...nothing. Confused :)
  8. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Create test.php script inside the same folder where you have your script with code:
    PHP:
    <?php 
    phpinfo
    (); 
    ?>
    This will display php settings. Check settings from session section and make sure that they exactly the same as in aMember CP -> Version Info.
  9. alanpeto

    alanpeto New Member

    Joined:
    Dec 28, 2004
    Messages:
    29
    Hi Alex,

    They are not...local values as shown in amember are 'on' for session.bug_compat_42 (off in test.php), and session.cookie_domain shows the domain in amember, but no value in test.php. Everything else looks the same in both.

    Is there something I need to do in amember? Thank you in advance for your help!
  10. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Can you provide two screenshots of session settings on both pages?
    You can do this in helpdesk if don't want to post these settings in the forum.

Share This Page