Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Display xprofile data in Activity Stream

@danbp

Participant

Hi @saxisme,

This function will add the company name under each user avatar, on every activity screen (swa, profile, friends…)
To do so, you have to add a do_action to the template. In your case, add it into (child theme)/buddypress/activity/entry.php, before the closing tag of the div containing the avatar (around line 24)

The snippet goes into theme’s functions.php or bp-custom.php

function saxisme() {
	$user_id = bp_get_activity_user_id();
	$company = xprofile_get_field_data('42', $user_id); // field ID or name
		
	echo '<div class="authorinfo">'. $company . '</div>';
	
}

add_action( 'showsaxisme', 'saxisme' );

You add this to entry.php
<?php do_action( 'showsaxisme'); ?>

Skip to toolbar