Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Buddypress 2.1.1 removes custom buttons from profile


  • crina27
    Participant

    @crina27

    I created a plugin that adds a Call button to the profile page. With Buddypress 2.0.1 it worked, but when I updated to 2.1.1 the button disappeared from the profile page.

    This is the code that adds the button :

    function videocall_get_slug() {
    global $bp;
    return $videocall_slug = isset( $bp->videocall->slug ) ? $bp->videocall->slug : ”;
    }
    
    function videocall_is_user_online( $user_id ) {
    if ( bp_has_members( ‘type=online&include=’. $user_id ) ) {
    return true;
    } else {
    return false;
    }
    }
    
    function videocall_get_video_chat_link() {
    return bp_loggedin_user_domain() . videocall_get_slug() . ‘/call?user=’.bp_displayed_user_id().’&id=’ . rand()
    }
    
    function videocall_invite_button() {
    
    if ( videocall_is_user_online( bp_displayed_user_id() ) ) {
    $link_class = ‘start-videocall online';
    } else {
    $link_class = ‘start-videocall';
    }
    
    bp_button( array(
    ‘id’ => ‘videocall’,
    ‘must_be_logged_in’ => true,
    ‘block_self’ => true,
    ‘wrapper_id’ => ‘videocall’,
    ‘link_href’ => videocall_get_video_chat_link(),
    ‘link_title’ => __( ‘Video call with this user.’, ‘videocall’ ),
    ‘link_text’ => __( ‘Video call’, ‘videocall’ ),
    ‘link_class’ => $link_class,
    ) );
    }
    add_action( ‘bp_member_header_actions’, ‘videocall_invite_button’,99);

    With WordPress 4.0 and Buddypress 2.0.1 it workes just fine.
    Any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Looks to me as though you are missing a mandatory param – ‘$component’ is listed as being ‘required’ if ‘component’ param empty or if the component not active the class returns false, adding a known active component string kicks things into life.

    But as you wrote your code you should be able to work out from the core class where things have broken and why:
    bp-core-classes.php


    crina27
    Participant

    @crina27

    I added an active component (‘xprofile’) and now it works. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Buddypress 2.1.1 removes custom buttons from profile’ is closed to new replies.
Skip to toolbar