Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to: Get template tag info outside the loop

  • Avatar of designodyssey
    designodyssey
    Participant

    @designodyssey

    I’ve searched and searched and although it seems simple maybe it’s just not possible but:

    I have a plugin that gets the ids of specific users and puts them in an array. I want to use the array to get the link to their profile page, but only for these ids. It operates on a post page with no BP loops.

    How?

    For example, I’m using this to get the avatar from wordpress, but BP tags don’t seem to work the same, unless I’m somewhere outside the loop that I shouldn’t be.

    foreach ($users as $user) {
    echo get_avatar($user);
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Andy Peatling
    Andy Peatling
    Keymaster

    @apeatling

    foreach ( $user_ids as $user_id )
    echo bp_core_get_userlink( $user_id );

    Avatar of designodyssey
    designodyssey
    Participant

    @designodyssey

    OK, that was way too simple. Thanks. Wouldn’t have found it unless I knew what I was looking for.

    After searching around for this function (and a comment from Burt), I see there are a few others in bp-core.php. Is there any listing of functions that take user_id or group_id and return information? I searched the “Docs” to no avail.

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

You must be logged in to reply to this topic.