Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add Friend in post

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

  • danbp
    Participant

    @danbp

    What is for you the relation between a post owner and a friend ? Unclear….
    Do you mean that only author’s friends can see the post author ?

    Your example page is blank.


    kelvinh92
    Participant

    @kelvinh92

    no, Can I let any Users add Author as a friend directly in each post?
    Sorry about not clear.
    Thank you very much.

    Eg. in http://myvintee.com/ad/2015-160315k1/ post. The author is kelvinh92, but the name can’t click, and cannot directly add kelvinh92 as my friend. How can I add kelvin92 as friend directly in the post?

    Hope you understand


    danbp
    Participant

    @danbp

    Add this to bp-custom.php

    function bpfr_add_friend_button() {
    $user_id = get_the_author_meta( 'ID' );
    $mybutton = bp_add_friend_button( $user_id ); 
    
    	if ( ( is_user_logged_in() && is_page( 'blog' ) ) ){
    		echo $mybutton;
    	}
    } 
    add_action( 'custom_zone', 'bpfr_add_friend_button' );

    And this to your child-theme/single.php at the place you want the button to appear.
    <?php do_action( 'custom_zone' ); ?>

    Depending your theme, you have to adjust the output with CSS and additionnal divs.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add Friend in post’ is closed to new replies.
Skip to toolbar