Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Member Tab


  • psmorrow
    Participant

    @psmorrow

    Hi, I’m interested in creating a custom Tab named “Calendar” on the Member page after the “Groups” tab.

    Any help is greatly appreciated!

    Thanks everyone!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Starting point is https://codex.buddypress.org/developer/function-examples/core/bp_core_new_nav_item/

    But adding a full function looks like:

    
    /**
     * adds the profile user nav link
     */
    add_action( 'bp_setup_nav', 'add_calendar_2_bp_nav_item' );
    function add_calendar_2_bp_nav_item() {
    	global $bp;
    
    	$args = array(
    		'name' => __( 'Calendar', 'buddypress' ),
    		'slug' => 'my-calendar',
    		'default_subnav_slug' => 'my-calendar',
    		'position' => 80,
    		'screen_function' => 'bp_nav_tab_stuff',
    		'item_css_id' => 'my-calendar',
    	);
    
    	bp_core_new_nav_item( $args );
    }
    

    But to do anything with the above, you’ll need to add stuff to display:

    
    /**
     * Creates the screen function content
     */
    function bp_nav_tab_stuff() {
    	add_action( 'bp_template_title',  'bp_nav_tab_screen_title' );
    	add_action( 'bp_template_content',  'bp_nav_tab_screen_content' );
    	bp_core_load_template( apply_filters( 'bp_core_template_plugin',  'members/single/plugins' ) );
    }
    
    function bp_nav_tab_screen_title() {
    	echo '<h3>My Calendar Title</h3>';
    }
    
    function bp_nav_tab_screen_content() {
    	echo '<p>You can choose to embed an iframe from Google Calendar and then the source will be the ID of the calendar you want to embed. You can find this under Settings > Calendar Address > Calendar ID.</p>';
    	echo '<p><iframe src="https://calendar.google.com/calendar/embed?src=barthmaier.com_sd2o58ua3efj7ne1m8o3p8n91g@group.calendar.google.com&ctz=America/New_York" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe></p>';
    	echo '<p>Of course, the above is just one way to add a calendar.</p>';
    }
    

    psmorrow
    Participant

    @psmorrow

    works awesome, thanks!


    psmorrow
    Participant

    @psmorrow

    Can you also show how to add the calendar tab to a group page after the home tab?

    A thousand thanks again for your help!


    bekircem
    Participant

    @bekircem

    How can i add custom link to that code?

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