Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Missing Add Friend Button

@mcuk

Participant

Hi @pedrohgl18,

and another in single.php child theme too.

Do you mean you used the same code twice? i.e. one in functions.php and one in single.php?

1. This code goes in either your bp-custom.php or functions.php (preferably the bp-custom.php):

function add_another_friend_button() {
	$user_id = get_the_author_meta( 'ID' );
	$mybutton = bp_add_friend_button( $user_id ); 
	if ( ( is_user_logged_in() && ! bp_is_my_profile() ) ) {
		echo $mybutton;
	}
} 

add_action( 'button_here', 'add_another_friend_button' );

2. Then insert the code below into the file where you wish your button to appear:

<div id="another-friend-button">
	<?php 
		do_action( 'button_here' ); 
	?>
</div><!-- #another-friend-button -->
Skip to toolbar