Skip to:
Content
Pages
Categories
Search
Top
Bottom

Trying to make new Activity tab


  • Chosker
    Participant

    @chosker

    hi there,
    I’m working on my site’s forums, powered by bbpress and buddypress.

    One thing I dislike is the existance of both Favorites and Subscriptions. perhaps there’s something I don’t understand but it seems reduntant. I can’t even get anything to show up under the Favorites tab of the Activity (tried to favorite a forum topic and then posting as another user, but nothing).

    to the point: I want to get rid of Favorites (already did) and only have Subscriptions.
    but I’d like the subscriptions’ activity to show up under the user Activity, in a new tab. Yes I know the user can see the subscribed forums in the members page -> Forums -> Subscriptions, but this is just the list and not a waterfall of the posts inside those threads.

    I’ve seen some posts where people try to add a new activity tab. this one was the clearest one, and I’ve tried following it to no avail. is the information completely outdated now?

    the problem is I cannot even get the hook ‘bp_activity_type_tabs’ to do anything. something as basic as this fails to produce anything:

    function bn_add_activity_tab() {
    	echo 'hello';
    }
    add_action( 'bp_activity_type_tabs', 'bn_add_activity_tab', 1, 2 );

    if I understand correctly it should hook itself to the activity type tabs. but it does absolutely nothing.
    I tried it in my theme’s functions.php, as well as in a plugin (which I also try to force be loaded after buddypress like this). other things in my plugin work (so I’m sure the plugin is loaded and working)

    any ideas?

    thanks

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

  • shanebp
    Moderator

    @shanebp

    Why do you have a ‘2’ in the accepted_args parameter?
    add_action( 'bp_activity_type_tabs', 'bn_add_activity_tab', 1, 2 );

    Your function will add ‘hello’ on the Site-Wide Activity page – not a member page > activity.

    To add a link to the Activity subnav on a member page, use bp_core_new_subnav_item.


    Chosker
    Participant

    @chosker

    thanks for the followup. guess I was looking at the wrong activity page! (I know about the global activity page, nor do I want it anyway)
    also nvm about the accepted_args param, wrong copy-paste

    I tried what you suggested and once I made my new subnav menu item into the template overload, quickly reached a blank point where I’d have no idea how to actually make the content (I tried following the trail to how the other Activity subnav links do it but couldnt find where its done)

    but now knowing that what I want is a subnav, a further search found me this valuable post.
    with the provided code I was able to add a new subnav into the member page > activity by using the bp_core_new_subnav_item function

    feels like im getting close (and in a more convenient way), and with the provided code it seems like I should already have a dummy page but instead when I click my new subnav item I get a 404 error page 🙁

    would you know why the new page isn’t getting generated?
    this is my code atm:

    function my_test_setup_nav() {
    	global $bp;
    
    	/* Add the subnav items to the profile */
    	// name, slug, parent_url, parent slug, screen function
    	bp_core_new_subnav_item( array( 'name' => __( 'Subscriptions' ), 'slug' => 'subscriptions', 'parent_url' => $bp->displayed_user->domain . 'activity/', 'parent_slug' => 'activity', 'screen_function' => 'my_profile_page_function_to_show_screen' ) );
    
    	function my_profile_page_function_to_show_screen() {
    		//add title and content here - last is to call the members plugin.php template
    		add_action( 'bp_template_title', 'my_profile_page_function_to_show_screen_title' );
    		add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen_content' );
    		bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    	}
    	function my_profile_page_function_to_show_screen_title() {
    		echo 'something';
    	}
    	function my_profile_page_function_to_show_screen_content() { 
    		echo 'weee content';
    	}
    }
    add_action( 'bp_setup_nav', 'my_test_setup_nav' );

    thanks again 🙂


    shanebp
    Moderator

    @shanebp

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying to make new Activity tab’ is closed to new replies.
Skip to toolbar