Skip to:
Content
Pages
Categories
Search
Top
Bottom

Caching the response of fetch_avatar

  • @gordyr

    Member

    Hi guys,

    I part way through developing a pretty huge (for me anyway) custom buddypress component that allows a user to upload songs, add them to a global database, tag them by mood, tempo and all sorts of other things.

    Anyway… Amongst the manyy features I currently have working is a ‘comments’ interface on each song.

    I am using the following code:-

    <a href="” title=””> $member_id, ‘type’ => ‘thumb’ ) ) ?>

    to display the avatar of a user that has commented (pelase note: this is not a wordpress post comment, this is using my own table and interface which is linked directly to each uploaded song in the database… so completely separate)

    {{comment_by}} is my own shortcode to return the user ID…

    Okay now that i’ve explained the above, my only problem is that I would like to cache the response of these avatar requests so that they are not called everytime the comments interface is viewed. Currently they take about 0.5 seconds to display as they are fetched from the server everytime.

    Is there anyway to cache this response so that these avatars are not requested everytime my comments interface is viewed?

    Thanks all!

Viewing 2 replies - 1 through 2 (of 2 total)
  • @gordyr

    Member

    Sorry my code didn’t seem to format properly… It should read:-

    <a href="” title=””> $member_id, ‘type’ => ‘thumb’ ) ) ?>

    @gordyr

    Member
    Code:
    <?php $member_id = bp_core_get_userid( ‘{{comment_by}}’ ) ?>

    <a href="<?php echo bp_core_get_user_domain( $member_id ) ?>" title="<?php echo bp_core_get_user_displayname( $member ) ?>"><?php echo bp_core_fetch_avatar ( array( ‘item_id’ => $member_id, ‘type’ => ‘thumb’ ) ) ?></a>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Caching the response of fetch_avatar’ is closed to new replies.
Skip to toolbar