Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Solved] What is the code for current logged in Member

  • @frank13

    Member

    Does anyone know the function call to retrieve the current logged in member?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @rogercoathup

    Participant

    Yes, it’s standard WordPress – did you Google?

    https://codex.wordpress.org/Function_Reference/get_currentuserinfo

    If you want their BP paths (profile URL) etc. then: https://codex.buddypress.org/developer-docs/the-bp-global/

    @frank13

    Member

    Thanks @RogerCoathup.

    I actually did Google it…i thought I needed a BP login.

    So I tried
    `get_currentuserinfo();
    echo $current_user->user_login;`

    But I get nothing.

    Then I tried `bp_loggedin_user_id()` and I get the ID NUmber — getting closer.

    To I tried `bp_loggedin_user_login()` but that fails to get me the user_login. It must not be a defined function call.

    Also tried `bp_loggedin_user()` and `bp_loggedin_user_name()` — nothing.

    Tried `$user_login` — no good…

    @frank13

    Member

    Solved it.

    Use WordPress functions but you must declare $current_user as GLOBAL

    `global $current_user;
    get_currentuserinfo();`

    Then you can reference:
    `$current_user->user_login`

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Solved] What is the code for current logged in Member’ is closed to new replies.
Skip to toolbar