Login/out WordPress functions doesn't work

Discussion in 'Integration' started by oscarmarcelo, Oct 2, 2012.

  1. oscarmarcelo

    oscarmarcelo New Member

    Joined:
    Aug 23, 2012
    Messages:
    5
    I want to include a login/out link in WordPress theme menu, and for that I used this code:
    PHP:
    <?php if(is_user_logged_in()){echo '<a id="login" href="'.wp_logout_url().'">Logout</a>';}else{echo '<a id="login" href="'.wp_login_url().'">Login</a>';}?>
    but it doesn't work.
    At first I thought that aMember wasn't detecting WordPress correctly, but my protected posts shows/hide as expected.

    What can I do?
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    Is it the logout link that isnt logging them out- or your code isnt detecting them as logged in?

    maybe change this .wp_logout_url(). to the amember logout url?
    /amember/logout

    If not registered in wordpress as logged in- then your integration isnt correct.

    David
  3. oscarmarcelo

    oscarmarcelo New Member

    Joined:
    Aug 23, 2012
    Messages:
    5
    The code isn't detecting login status, but after I post this thread, I spotted it showing as Logout, but maybe once or twice in like 50 page clicks/refreshes.
    And the aMember WordPress plugin works fine...
    I checked the integration... I didn't see anything wrong... is it because I'm using a local server (XAMPP on Windows)?

Share This Page