Skip to:

php code for output username in activity stream

  • blacktattoo


    Hello good people,
    I’ve been customizing my activity stream and the thing is I’ve been trying to figure out the php code that echoes the username in activity stream. I deleted because I want to display only the content. But besides that I need to display only contents author.

    Uploaded with

    hope you can help me with my issue!

Viewing 3 replies - 1 through 3 (of 3 total)
  • well the “action” is where the username is displayed but that contains the entire “title” of the activity stream. ( thisuser posted an update: )

    but you could use bp_get_activity_user_id() in the loop and reference one of the bp_core get username functions



    @blacktattoo – You could try the BP Usernames Only plugin if you want to replace the display name with the username:

    If you want to add it to the activity content, you could apply a filter to “bp_get_activity_content”.



    Thanks guys, both of you have been a real help … I managed to figure it out
    My solution was following…
    In my template I used a function bp_activity_user_id() which echoed user ID , but instead of ID I needed username or displayname . So in bp-activity-templatetags.php I edited the line 380
    from this:
    return apply_filters( ‘bp_get_activity_user_id’, $activities_template->activity->user_id );
    to this:
    return apply_filters( ‘bp_get_activity_user_id’, $activities_template->activity->display_name );

    You can see it in action here:

    thanks again ;)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php code for output username in activity stream’ is closed to new replies.
Skip to toolbar