Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Patrick
    Participant

    @zaanmedia

    @shanebp

    My code is the following and i got an error500 with your code. Did i forgot something to do i’m confused. No feedback from anyone if this solution worked or not?

    function 3tmj_count_profile( $user_id = 0 ) {
    	global $wpdb;
    
    	if ( empty( $user_id ) )
    		$user_id = bp_displayed_user_id();
    
    	return $wpdb->get_var( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_author = $user_id AND post_type IN { 'wpcm_vehicle' }  AND post_status = 'publish'" );
    
    }
    
    function profile_tab_advertenties() {
        	global $bp;
    
    	$count = 3tmj_count_profile();
    	
    	$class = ( 0 === $count ) ? 'no-count' : 'count';
    	
    	$name = sprintf( __( 'My Posts <span class="%s">%s</span>', 'buddypress-meets-wp-car-manager' ), esc_attr( $class ), number_format_i18n( $count ) );
    
    	//$name = sprintf( __( 'Advertenties <span class="%s">%s</span>', 'buddypress-meets-wp-car-manager' ), esc_attr( $class ), number_format_i18n( $count ) );
    	//$name = 'Advertenties <span>' . count_user_posts( bp_displayed_user_id(), array( 'wpcm_vehicle', 'post' ) ) . '</span>';
    
       	bp_core_new_nav_item( array( 
    		'name' => $name,
    		'slug' => __( 'advertenties', 'buddypress-meets-wp-car-manager' ), 
            	'screen_function' => 'advertenties_screen', 
            	'position' => 30,
    	    	'parent_url'      => bp_displayed_user_domain()  . __( '/advertenties/', 'buddypress-meets-wp-car-manager' ) ,
    	    	'parent_slug'     => $bp->profile->slug,
    		'default_subnav_slug' => __( 'advertenties', 'buddypress-meets-wp-car-manager' ), 
        ) );
    }
    add_action( 'bp_setup_nav', 'profile_tab_advertenties', 10);

    Patrick
    Participant

    @zaanmedia

    I’m also trying to do the same thing! Did you ever find the solution to make it work?

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar