Skip to:
Content
Pages
Categories
Search
Top
Bottom

Missing Add Friend Button

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

  • @mcuk
    Participant

    @mcuk

    Hi @missgridiron,

    Add this to your 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' );

    Then add the code below to wherever you want the button to appear (e.g. in the member-header.php file of your child theme if you want a button in your profile page header):

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

    for reference: https://buddypress.org/support/topic/add-friend-button-everywhere/


    dave8528
    Participant

    @dave8528

    Since I could not find bp-custom.php and I found out that it not a default file, so the directions here: https://codex.buddypress.org/themes/bp-custom-php/ says to create it manually – which I did and added the above code as you directed. Then I located member-header.php in following directory tree shown below and added your code:
    /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/member-header.php

    But, I don’t see it working! Did I get the files mixed up?
    Thanks for all help.


    pedrohgl18
    Participant

    @pedrohgl18

    i have the same problem,
    i did the same solution but didnt work.

    i put this code in funcions.php child theme
    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’ );

    and another in single.php child theme too.

    any other solution ?


    @mcuk
    Participant

    @mcuk

    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 -->

    pedrohgl18
    Participant

    @pedrohgl18

    yes, that’s what i did.
    i put the first code in functions.php and the second on member-header.php of child theme.


    @mcuk
    Participant

    @mcuk

    Do you have cover images active?

    If so the file you want is cover-image-header.php .


    pedrohgl18
    Participant

    @pedrohgl18

    yes, i have, but doesnt work too.
    and i cant find this file cover-image-header.php in my child theme, only in main theme. that’s correct ?
    btw thanks for the fast reply


    @mcuk
    Participant

    @mcuk

    So you are using cover images but they aren’t working? Or do you just mean the button isn’t appearing?

    Since you are using cover images the second code segment (number 2 above) needs to be placed in cover-image-header.php . It won’t appear if you put it in member-header.php because that is for profiles when you haven’t activated the use of cover images.

    That’s correct it won’t be in your child theme unless you’ve already put it there to make modifications. So it sounds like you need to copy the cover-image-header.php into your child theme following the same file structure. Something like:

    mychildtheme>buddypress>members>single

    (it goes in the single folder).

    Hopefully you’ll see the button now


    pedrohgl18
    Participant

    @pedrohgl18

    sorry for my dumb questions.
    my cover imagens aren’t working ๐Ÿ™ . i tried update but dont change the image.

    let me explain, i’m using a wlms theme and not a buddypress theme
    this is what i did, first i try tu edit the files functions and cover-image-header from this folder
    /public_html/wp-content/plugins/buddypress/bp-themes/bp-default
    not work this way.

    So finally i WIN !! thanks for u ! hahaha
    this is the folder u have to edit ( for future questions by another users )
    i edit insite the child theme
    /public_html/wp-content/themes/wplms_modern functions.php
    and
    /public_html/wp-content/themes/wplms_modern/members/single member-header.php


    @mcuk
    Participant

    @mcuk

    Maybe ask the wplms authors for help as to why your cover images aren’t working? I haven’t used that theme so can’t help there.

    Glad you finally got there!


    pedrohgl18
    Participant

    @pedrohgl18

    but now i have another problem.

    when i send a friend request, comes to me my friends request and not to my friend.
    is like i send a request for u, but the notification for accept come to me but i cant accept
    ๐Ÿ™


    @mcuk
    Participant

    @mcuk

    Haven’t encountered that problem myself so wouldn’t really know where to start. The code above does work fine with notifying the person you are trying to be friends with (I’ve just double checked on my project).

    Might even be a conflict with something in your theme or another plugin you are using. You could also try disabling other plugins to check if that is an issue and switching themes to one of the WordPress default themes to see if it works as it should.

    Only other suggestion I can give is to start a new forum thread and maybe someone else has encountered that issue.


    pedrohgl18
    Participant

    @pedrohgl18

    after 30 minutos, starts to work normally… LOL
    thanks again for care and help me.
    if u dont mind, can u add me on skype? pedrohgl18


    @mcuk
    Participant

    @mcuk

    I’m not on Skype ๐Ÿ™‚ .

    Glad it worked in the end.


    ripulkr
    Participant

    @ripulkr

    I also have the WPLMS theme, there is switch in the theme which enables this.
    The switch is located in WP Admin – WPLMS – BuddyPress – Member meta info


    pedrohgl18
    Participant

    @pedrohgl18

    Thanks ripulkr ! that’s correct ! =)

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar