Skip to:
Content
Pages
Categories
Search
Top
Bottom

Template tag for activity_username

  • @ch8rt

    Member

    I can’t find any documentation around the template tag for the username of the person that created an item in the activity stream.

    At the moment I’m stuck with the ID of that user, does anyone know the tag?

Viewing 9 replies - 1 through 9 (of 9 total)
  • @ch8rt

    Member

    Anyone?

    @rogercoathup

    Participant

    Pass the ID into bp_core_get_username

    @ch8rt

    Member

    Seems a bizzarre way around it? if I can use `bp_activity_user_id()` to get the id of the user that posted the item why isn’t there a ‘bp_activity_user_nicename()’ or something similar?

    Anyway, I’ll look into your suggestion on both this and the other topic you’ve replied to, thanks.

    @rogercoathup

    Participant

    Yes, it’s missing from the API. If you want it as a single function call, you can always write your own: my_activity_user_nicename() and put it in your bp-custom.php

    And, submit it to the trac as an API enhancement!

    @ch8rt

    Member

    I was hoping that “ would fix it, apparently not, it just shows the ID number still.

    @rogercoathup

    Participant

    That surprises me… Post your full code sample, to show how you are calling it

    @ch8rt

    Member

    Well Its a bit messy, but I’m trying to re-engineer the meta part of the entry, so I’ll be using it in a few places like
    `<a class="activity-avatar" title="”
    href=”” title=”user name here”>

    `
    To add the username as a title on the Avatar, so it shows on mouseover. And
    `
    <a class="author" href="”> said:

    `
    As a prefix to the post content. Then I’m moving the rest of the meta data to the bottom of the post so I can drop the opacity of it since its less important.

    @rogercoathup

    Participant

    It’s not working because you are not passing an integer parameter for the user_id to bp_core_get_username()

    bp_activity_user_id() is a template tag for echoing a value to the screen, not for fetching a value to pass to a function.

    Instead use:

    @ch8rt

    Member

    A massive help yet again. Thanks Roger for taking the time to answer these questions.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Template tag for activity_username’ is closed to new replies.
Skip to toolbar