Skip to:
Content
Pages
Categories
Search
Top
Bottom

Notification avatars


  • Andrew
    Participant

    @snd26

    I’ve been trying to work out how to get the user IDs for the notification items so I can display notification user avatars.

    Is this the best way to do it, I’ve tested this with a few users and seems to work:

    function test_notifications_avatar() {
    	
    	$bp      = buddypress();
    	$user_id = $bp->notifications->query_loop->notification->secondary_item_id;
    	
    	if ( empty( $user_id ) )
    		$user_id = $bp->notifications->query_loop->notification->item_id;
    
    	echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type'  => 'thumb' ) );
    }
  • You must be logged in to reply to this topic.
Skip to toolbar