BuddyDev

Search

[Resolved] Custom info in profile header meta doesn't show after theme update

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #28785

    Hi

    After upgrading to newest Community Builder Pro my existing code for displaying custom info in the profile header meta doesn’t work!?

    I have this code:

    function cci_display_user_address() {
        if ( bp_is_user() ) {
            $user_id = bp_displayed_user_id();
        }
        else {
            $user_id = bp_get_member_user_id();
        }
        
        $args = array(
            'numberposts'   => -1,
            'post_type'     => 'cci_family',
            'meta_query'     => array(
                'relation' => 'OR',
                array(
                    'key'     => 'family_members',
                    'value'   => '"' . $user_id . '"',
                    'compare' => 'LIKE'
                ),
                array(
                    'key'     => 'family_members',
                    'value'   => $user_id,
                    'compare' => '='
                ),
            ),
        );
    
        $the_query = new WP_Query( $args );
        if ($the_query->have_posts() ) {
            while ( $the_query->have_posts() ) {
                $the_query->the_post();
                echo do_shortcode( '[cci_apartmentname id='.get_the_ID().']' ); 
            }
        }
        else {
            echo __( 'Not connected to an appartment', 'cohousing-community-intranet' );
        }
    }
    add_action( 'bp_profile_header_meta', 'cci_display_user_address' ); // insert user's address in profile header
    add_shortcode( 'cci_display_user_address', 'cci_display_user_address' ); // insert user's address using a shortcode
    
  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #28786

    Hi Torben,
    I am sorry for the inconvenience. The hooks have changed.

    Please use ‘bp_member_header_meta’ or ‘bp_member_header_info’ instead of ‘bp_profile_header_meta’

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #28787

    WAUW. Quick answer, Brajesh 🙂

    It works! Do you have a list with changes in hook names etc.?

    Best regards
    Torben

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #28788

    Hi Torben,
    Thank you.

    We have the documentation still under work and we are hoping that full documentation will go live early next month. Till then, Please feel free to post any question/issue here.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #28789

    Hi Brajesh

    That sounds perfect to me 🙂

    How do I get rid of the member’s active status in the profile header?
    Take a look at my scrrenshot at https://www.dropbox.com/s/qxh5cv060632mts/Screenshot%202020-04-11%20at%2016.32.07.png?dl=0

    /Torben

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #28790

    Thank you.

    Please use this code

    
    add_filter( 'cb_show_member_header_last_active', '__return_false' );
    

    Or you can use our Profile visibility manager and let users decide for themselves(if needed).

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 88
    Torben Heikel Vinther on #28793

    Awesome. I’ll go with your code 🙂

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #28796

    Great. All the best 🙂

The topic ‘ [Resolved] Custom info in profile header meta doesn't show after theme update’ is closed to new replies.

This topic is: resolved