Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thanks for the code. Here’s the updated code for todays’ versions of NavXT and Buddy Press:

    /*
     * An action to show decent breadcrumbs for buddypress components
     */
    add_action( 'bcn_before_fill', 'nass_breadcrumb_do_bp' );
    function nass_breadcrumb_do_bp( $bcn_trail ) {
    	if ( bp_is_blog_page() || ! bp_current_component()) return; // not doing a buddypress thang, so go home
    	$comp = bp_current_component();
    
    	do_breadcrumb_for_component($bcn_trail, $comp);
    }
    function do_breadcrumb_for_component($bcn_trail, $comp) {
    	$titles = Array( 'members' => "U?ytkownicy");  // add more in here if needed
    	$comp_title = isset($titles[$comp]) ? $titles[$comp] : ucfirst($comp);
    	global $bp;
    
    	// Just hard code all this, it's Wrong but will work for now
    	if ('profile' == $comp || 'settings' == $comp) {
    		// want the trail to end with the person, then before that have the members slug
    		// so who is the person?
    		$breadcrumb = $bcn_trail->add( new bcn_breadcrumb($bp->displayed_user->fullname, '', ''));
    		$breadcrumb->set_url(NULL, $bp->displayed_user_domain);
    		do_breadcrumb_for_component($bcn_trail, 'members');
    	} else if ('groups' == $comp || 'messages' == $comp) {
    		if ( $bp->is_single_item ) {
    			// this one's name
    			$pname = ucwords( $bp->current_item );
    			$breadcrumb = $bcn_trail->add( new bcn_breadcrumb( $pname, '', ''));
    		}
    		$breadcrumb = $bcn_trail->add( new bcn_breadcrumb($comp_title, '<a href="'.site_url() . '/' . $comp . '/'.'">%htitle%</a>'));
    		if ($bp->displayed_user->id )  {
    		 	do_breadcrumb_for_component($bcn_trail, 'profile');
    		}
    	} else {
    		if (!is_page())
    			$breadcrumb = $bcn_trail->add( new bcn_breadcrumb($comp_title, '<a href="'.site_url() . '/' . $comp . '/'.'">%htitle%</a>'));
    	}
    }

    It’s not good enough, still.

Viewing 1 replies (of 1 total)