Skip to:
Content
Pages
Categories
Search
Top
Bottom

Calling currently displayed user

  • Avatar of FrPSh
    FrPSh
    Member

    @frpsh

    I want to call the currently displayed user’s username in my code.
    I need to grab this username completely devoid of styling/spaces so that I can use it to call stuff from a database.
    What’s the best way to do this? `bp_displayed_user_username();` hasn’t seemed to work with the database.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of @ChrisClayton
    @ChrisClayton
    Participant

    @chrisclayton

    bp_displayed_user_username() is a wrapper function that echo’s the username.
    If you want to use it to “call stuff from a database”, i think you need to use the following (which will return the username rather than echo it.

    bp_get_displayed_user_username();

    Avatar of FrPSh
    FrPSh
    Member

    @frpsh

    Thank you so much! That’s just what I needed to get it working.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.